grunt-smg
Plugin for generating $script manifests
Have you ever written script like this by hand?
;$script;$script;
Well this will generate it for you from much more concise notation using nice glob expressions:
smg: main: steps: 1: '**/jquery/jquery.js' '**/routes.js' 2: 'public/js/**/angular.min.js' '**/bootstrap/js/*.js' 3: 'public/js/*.js' '**/angular-route.min.js' '**/js/controllers/*.js' '**/js/services/*.js' relativeTo: 'public' dest: 'public/scriptLoader.js'
instead of providing an object, you can put your steps in a separate node module file and put relative path to the module file as a value for steps
property.
Like this:
smg: main: steps: '/test/scriptManifest.js' relativeTo: 'public' dest: 'public/scriptLoader.js'
Getting Started
This plugin requires Grunt ~0.4
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-smg --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "smg" task
Overview
In your project's Gruntfile, add a section named smg
to the data object passed into grunt.initConfig()
.
grunt
Prefixed with @ all paths in the step will not be resolved via glob expressions, this can be used to specify remote URLs or paths which are not resolvable in build time.
'@1': '...URL..'