Add grunt.js file with a linter, minifier, compiler, build script (compile + min…
…ify) and a watcher to automatically build.
Showing
1 changed file
with
27 additions
and
0 deletions
grunt.js
0 → 100644
1 | module.exports = function(grunt) { | ||
2 | grunt.initConfig({ | ||
3 | lint: { | ||
4 | files: ['grunt.js', 'lib/**/*.js', 'spec/**/*.js'] | ||
5 | }, | ||
6 | min: { | ||
7 | dist: { | ||
8 | src: 'lib/rivets.js', | ||
9 | dest: 'lib/rivets.min.js' | ||
10 | } | ||
11 | }, | ||
12 | watch: { | ||
13 | files: 'src/rivets.coffee', | ||
14 | tasks: 'build' | ||
15 | }, | ||
16 | }); | ||
17 | |||
18 | grunt.registerTask('default', 'watch'); | ||
19 | |||
20 | grunt.registerTask('compile', 'Compiles CoffeeScript source into JavaScript.', function(){ | ||
21 | var coffee = require('coffee-script'); | ||
22 | var js = coffee.compile(grunt.file.read('src/rivets.coffee')); | ||
23 | if (js) grunt.file.write('lib/rivets.js', js); | ||
24 | }); | ||
25 | |||
26 | grunt.registerTask('build', 'compile min'); | ||
27 | }; |
-
Please register or sign in to post a comment