From f71590449c281f8f4fa92c0da629a7e8fd3e36a6 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 10 Sep 2013 12:39:17 +0200 Subject: [PATCH] add hash to build files & correct minor fix --- Gruntfile.js | 22 +++++++++++++++++++--- package.json | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8858a8a5e9..bda73f22d7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,7 +5,7 @@ module.exports = function(grunt) { grunt.initConfig({ clean: { - build: ['public/build'] + build: ['build'] }, uglify: { @@ -108,6 +108,21 @@ module.exports = function(grunt) { } }, + // UPDATE IT! + hashres: { + build: { + options: { + fileNameFormat: '${name}-${hash}.${ext}' + }, + src: [ + 'build/*.js', 'build/*.css', + 'build/bower_components/bootstrap/docs/assets/css/*.css', + 'build/bower_components/habitrpg-shared/dist/*.css' + ], + dest: 'make-sure-i-do-not-exist' + } + }, + nodemon: { dev: { ignoredFiles: ['public/*', 'Gruntfile.js', 'views/*', 'build/*'] // Do not work! @@ -134,8 +149,8 @@ module.exports = function(grunt) { }); // Register tasks. - grunt.registerTask('build:prod', ['clean:build', 'uglify', 'stylus', 'cssmin']); - grunt.registerTask('build:dev', ['clean:build', 'stylus', 'cssmin']); + grunt.registerTask('build:prod', ['clean:build', 'uglify', 'stylus', 'cssmin', 'hashres']); + grunt.registerTask('build:dev', ['clean:build', 'stylus', 'cssmin', 'hashres']); grunt.registerTask('run:dev', [ 'build:dev', 'concurrent' ]); @@ -147,5 +162,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-nodemon'); grunt.loadNpmTasks('grunt-concurrent'); grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-hashres'); }; diff --git a/package.json b/package.json index 5e24f91961..74e72c179a 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "grunt-contrib-clean": "~0.5.0", "grunt-contrib-cssmin": "~0.6.1", "grunt-contrib-watch": "~0.5.x", + "grunt-hashres": "~0.3.2", "grunt-nodemon": "~0.1.1", "grunt-concurrent": "~0.3.1", "bower": "~1.2.4",