Grunt
Grunt is a build tool much like Ant or Maven, but using the beauty of Javascript.
- grunt.file - reading, writing files
- Testing Mocha applications with Grunt using Jenkins
My Grunt plugins:
Publishing a new Grunt plugin
See Creating Plugins in Grunt. In particular:
- Install grunt-init with
npm install -g grunt-init
- Install the gruntplugin template with
git clone git://github.com/gruntjs/grunt-init-gruntplugin.git ~/.grunt-init/gruntplugin
- Run
grunt-init gruntplugin
in an empty directory. Valid licenses are MIT, GPL-2.0, etc. - Run
npm install
to prepare the development environment. - Author your plugin.
- Run
npm adduser
to create a new user for publishing plugins - use any username/password/etc you want. - Run
npm publish
to publish the Grunt plugin to npm! - Use
npm search <plugin-name>
to check the plugin is now there
Pushing a new version of a Grunt plugin
- Update
version
inpackage.json
- Run
npm publish
to republish the Grunt plugin to npm - Use
npm search <plugin-name>
to check the plugin version is updated
There’s no git tagging or anything like that.
Getting Gruntfile.coffee working
- Install necessary Grunt packages:
npm install --save-dev grunt grunt-contrib-coffee grunt-cli
- Create a
Gruntfile.coffee
:module.exports = (grunt) -> grunt.registerTask 'default', 'Try Logging', -> grunt.log.write('Running the default task')
- Run
grunt
Concatenating Javascript files together
Use the grunt-neuter task.
neuter:
dist:
src: 'site/generated/js/generated-coffee.js',
dest: 'site/generated/js/generated-coffee-compiled.js'
generated-coffee.js
can have things like require('path/*')
.