-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[REMOVED] Aggregation core module
This core module aggregates all the specified JavaScript and CSS resources and produces three files:
-
aggregated.css
for the header of the page -
aggregated.js
for the header of the page -
aggregated.js
for the footer of the page
For each file to be aggregated, Aggregation module has to be told:
- Path to the file
- Type of the file (js or css)
- If the file is of js type, location of the file (header or footer)
- (Optionally) a weight number may be specified to hint for the ordering of the file within the aggregated.js
There are two basic ways to tell the Aggregation module what files to aggregate:
- Global approach: use the assets.json file in the config directory of your mean installation
- Local approach (the Package approach): use the aggregateAsset method of your Module class (from which all the Package Modules are/should be derived)
Standard contents of this file is
{ "core": { "css": { "bower_components/build/css/dist.min.css": [] }, "js": { "bower_components/build/js/dist.min.js": [ "bower_components/jquery/dist/jquery.min.js", "bower_components/angular/angular.js", "bower_components/angular-mocks/angular-mocks.js", "bower_components/angular-cookies/angular-cookies.js", "bower_components/angular-resource/angular-resource.js", "bower_components/angular-ui-router/release/angular-ui-router.js", "bower_components/angular-bootstrap/ui-bootstrap.js", "bower_components/angular-bootstrap/ui-bootstrap-tpls.js" ] } } }
Currently, only the core
group is supported. It has the css
section (that goes to the header, just like any css) and the js
section that goes to the footer. js files listed in assets.json will appear in the aggregated.js in the same order.
Once your package module is instantiated from Meanio.Module (or class inherited from Meanio.Module), you will have the Module's aggregateAsset at hand. The method accepts 3 parameters:
- type of the asset (String, 'js' or 'css')
- path to the file to be aggregated (relative from the
public/assets
directory of your package directory root) - (optional) options
The options parameter is a hash. It may have the following keys:
- group - String, 'header' or 'footer'. Default value is 'footer'
- inline - boolean,
true
orfalse
. Default value isfalse
. Iftrue
, Aggregation module will treat the path to the file as a String, and put that String verbatim into the aggregated result file. - url - String, url pointing to a remote css or js resource. Server will send a request to the url specified and put the response from the remote server verbatim into the aggregated result file. Default value is an empty string, so no request will be sent.
For debugging purposes, you may wish to turn the Aggregation functionality off. That is done by placing a
aggregate:false
key-value pair in the appropriate config file (in the config/env
directory of your mean installation).
Aggregation module minifies all the JavaScript resources by default. You may turn this feature off by placing a
debug:true
key-value pair in the appropriate config file (in the config/env
directory of your mean installation).
- Getting Started Guides
- Deployment
- Testing
- System Deep Dives
Aggregation- Packages
- Database
- Menus
- Circles (roles/permissions) High Level Overview
- Circles code examples
- User Auth withJWT
- Contributing