grunt-minispade
v0.1.8
Published
wraps .js files in minispade closures for use with minispade.js
Downloads
1
Readme
grunt-minispade
wraps .js files in minispade closures for use with minispade.js
Getting Started
This plugin requires Grunt ~0.4.0
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-minispade --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-minispade');
The "minispade" task
Overview
In your project's Gruntfile, add a section named minispade
to the data object passed into grunt.initConfig()
.
You will probably want to use the syntax of "src-dest" shown below in most cases as you are typically going to be wrapping many files in minispade closures and then concatenating them all into one output source file.
grunt.initConfig({
minispade: {
options: {
// Task-specific options go here.
},
files: {
src: ['whereMyFilesAre/*.js'],
dest: 'outputFile.js',
},
},
})
Default Options
Choose a separator character to place between concatenated files. This feature is left in as a courtesy to other grunt plugins' formats but it's not particularly useful here and should be left alone in most cases.
grunt.initConfig({
minispade: {
options: {
separator: "",
},
files: {
//file stuff
},
},
})
Custom Options
renameRequire: if your source files use "require or requireAll" you will need to find and replace them with "minispade.require and minispade.requireAll". Set this flag to true to enable this feature. useStrict: adds javascript's 'use strict' inside each registered minispade closure. prefixToRemove: if your source files come from a directory structure that doesn't match the structure your require statements use to find those modules, you may need to specific a string here that will be removed from all "minispade.register" closures. E.G. If your javascript files are first compiled from coffeescript files they may be outputted in a directory called "compiledJS". Your register statements thus need to have "compiledJS/" removed from them in order for your requires to find them.
grunt.initConfig({
minispade: {
options: {
renameRequire: true,
useStrict: true,
prefixToRemove: "",
},
files: {
//file stuff
},
},
})
Contributing
To contribute, contact @stv_kn or email [email protected] or [email protected]. Alternatively, create a fork and pull request on github.
Release History
0.1.0 March 12, 2013 initial release