grunt-dojo-alt-build
Concatenate and minify all javascript files and html templates into a single, dojo-readable file
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-dojo-alt-build --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
or by using the load-grunt-tasks
plugin:
grunt;
The "dojo_alt_build" task
Overview
In your project's Gruntfile, add a section named dojo_alt_build
to the data object passed into grunt.initConfig()
.
grunt;
Options
options.pkgs
Type: Object
An object listing the local packages in dojoConfig that should be built.
files
Type: file list
A list of js modules and html templates to be concatenated and minified. (note: this is a sibling to, not within, the options
object)
See Grunt documentation for different structure options.
Usage Examples
For a project with dojoConfig:
var dojoConfig = parseOnLoad: true packages: name: 'app' location: locationPath + 'js/app' name: 'components' location: locationPath + 'js/components' name: 'config' location: locationPath + 'js/config' ;
an app
target for the dojo_alt_build
task looks like this (assuming a config
module that should be excluded from the build process).
dojo_alt_build: app: options: pkgs: // list the local packages in dojoConfig that should be built. // (don't include config package here) 'app': 'js/app' 'components': 'js/components' files: 'release/js/app.min.js': // all js and html files from the js folder except config 'js/**/*.js' 'js/**/*.html' '!js/config/*'
and release/index.html
would include a script tag to import the built modules,
and a require statement to the module that kicks off the application.
Contributing
todo
Release History
todo