Add a banner to prepend to builds.
Showing
1 changed file
with
11 additions
and
2 deletions
1 | module.exports = function(grunt) { | 1 | module.exports = function(grunt) { |
2 | grunt.initConfig({ | 2 | grunt.initConfig({ |
3 | pkg: '<json:package.json>', | ||
4 | meta: { | ||
5 | banner: | ||
6 | '// rivets.js\n' + | ||
7 | '// version: <%= pkg.version %>\n' + | ||
8 | '// author: <%= pkg.author %>\n' + | ||
9 | '// license: <%= pkg.licenses[0].type %>' | ||
10 | }, | ||
3 | lint: { | 11 | lint: { |
4 | files: ['grunt.js', 'lib/**/*.js', 'spec/**/*.js'] | 12 | files: ['grunt.js', 'lib/**/*.js', 'spec/**/*.js'] |
5 | }, | 13 | }, |
6 | min: { | 14 | min: { |
7 | dist: { | 15 | dist: { |
8 | src: 'lib/rivets.js', | 16 | src: ['<banner:meta.banner>', 'lib/rivets.js'], |
9 | dest: 'lib/rivets.min.js' | 17 | dest: 'lib/rivets.min.js' |
10 | } | 18 | } |
11 | }, | 19 | }, |
... | @@ -20,7 +28,8 @@ module.exports = function(grunt) { | ... | @@ -20,7 +28,8 @@ module.exports = function(grunt) { |
20 | grunt.registerTask('compile', 'Compiles CoffeeScript source into JavaScript.', function(){ | 28 | grunt.registerTask('compile', 'Compiles CoffeeScript source into JavaScript.', function(){ |
21 | var coffee = require('coffee-script'); | 29 | var coffee = require('coffee-script'); |
22 | var js = coffee.compile(grunt.file.read('src/rivets.coffee')); | 30 | var js = coffee.compile(grunt.file.read('src/rivets.coffee')); |
23 | if (js) grunt.file.write('lib/rivets.js', js); | 31 | var banner = grunt.task.directive('<banner:meta.banner>', function() { return null; }); |
32 | if (js) grunt.file.write('lib/rivets.js', banner + js); | ||
24 | }); | 33 | }); |
25 | 34 | ||
26 | grunt.registerTask('build', 'compile min'); | 35 | grunt.registerTask('build', 'compile min'); | ... | ... |
-
Please register or sign in to post a comment