Skip to content

Commit

Permalink
added date to build files via grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
schteppe committed Apr 14, 2015
1 parent 3d2195e commit 4311b3f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,19 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['concat', 'browserify', 'uglify', 'addLicense', 'requireJsFix']);
grunt.registerTask('default', ['test', 'concat', 'browserify', 'uglify', 'addLicense', 'addDate', 'requireJsFix']);
grunt.registerTask('test', ['nodeunit']);

grunt.registerTask('addDate','Adds the current date to the top of the built files',function(){
var text = '// ' + new Date().toUTCString() + '\n';

var dev = fs.readFileSync(bundlePath).toString();
var min = fs.readFileSync(minifiedBundlePath).toString();

fs.writeFileSync(bundlePath,text+"\n"+dev);
fs.writeFileSync(minifiedBundlePath,text+"\n"+min);
});

grunt.registerTask('addLicense','Adds the LICENSE to the top of the built files',function(){
var text = fs.readFileSync("LICENSE").toString();

Expand Down

0 comments on commit 4311b3f

Please sign in to comment.