grunt-multi-pages-assets-generator v0.1.9
grunt-multi-pages-assets-generator
A grunt plugin to assemble css & js for multiple pages
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-multi-pages-assets-generator --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-multi-pages-assets-generator');
The "multi_pages_assets_generator" task
Overview
In your project's Gruntfile, add a section named multi_pages_assets_generator
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
multi_pages_assets_generator: {
options: {
jsFolder: 'app/2_js',
jsComponents :'bower_components',
cssFolder: 'tmp/css',
jsCompression:true,
cssCompression:false,
configJSON: 'config.json'
},
files: {
src: 'tmp',
dest: 'generated/static'
}
}
});
Options
options.jsFolder
Type: String
Default value: ''
This folder should contain your prepared Javascript for combination
options.cssFolder
Type: String
Default value: ''
This folder should contain your prepared CSS for combination
options.configJSON
Type: String
Default value: ''
options.jsCompression
Type: Boolean
Default value: false
The js will not be compressed
options.cssCompression
Type: Boolean
Default value: false
The css will not be compressed
This file should exist and have the right values see example lower Config example
{ "pages": [{
"idName": "home",
"page": "tmp/index.html",
"css": [
"index.css",
"modules/menu.css"
],
"js": [
"index.js",
"modules/menu.js"
]
}] }
Usage Examples
Default Options
grunt.initConfig({
multi_pages_assets_generator: {
options: {
jsFolder: 'tmp/js',
cssFolder: 'tmp/css',
configJSON: 'config.json'
},
files: {
src: 'tmp',
dest: 'static'
}
}
});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
(Nothing yet)