an example grunt file for an app framework in angular, with pre-processor targets to work with cordova/phonegap.
the framework project itself can be scaffolded out with yeoman, providing the expected directory structure for the scripts and tests. for such a framework, the views folder is empty, and the app.js can be written to provide only the module definitions. the index.html file is unused, as all JS files under scripts are written to framework.js
this particular framework uses pre-processor targets of WEBAPP and NATIVE. the pre-processor can be used to include/exclude entire services, depending on deployed environment.
the default target, in addition to running jshint and the unit tests, will deploy 3 framework files to the top-level 'dist' folder:
- framework.js, does not run the pre-processor. use this file in your app when the app's grunt file will do the pre-processing step.
- framework_webapp.js, excludes the native code. use this file in your app when targeting a browser, and the app's grunt file has no pre-processing step.
- framework_native.js, reverse of the webapp. again, the app's grunt file has no pre-processing step.
also note the npm tasks loaded by the file. ensure those are saved to the package.json file (not included in this gist).
in Gruntfile_fooapp.js, selected bits are included to illustrate how to access the framework.js file(s). The base grunt file is heavily based on the default grunt file scaffolded by yeoman.
Assume a directory structure like this:
- suite
- suite/apps
- suite/apps/fooapp
- suite/apps/fooapp/dist
- suite/apps/framework
- suite/apps/framework/dist
- suite/native
- suite/native/fooapp
- suite/native/fooapp/www (a cordova or phonegap 3.x deploy area)