Skip to content

Instantly share code, notes, and snippets.

@abhshkdz
Created November 14, 2013 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhshkdz/7460904 to your computer and use it in GitHub Desktop.
Save abhshkdz/7460904 to your computer and use it in GitHub Desktop.
module.exports = function(grunt){
"use strict";
/* Load grunt modules */
require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
/* Configuration file */
var config = grunt.file.readJSON('config/config.json');
grunt.initConfig({
cssmin: {
production: {
src: 'assets/*.css',
dest: 'assets/dist/style.css'
}
},
uglify: {
production: {
files: {
'assets/dist/main.js': ['assets/*.js']
}
}
},
env: {
development: {
NODE_ENV: 'development'
},
production: {
NODE_ENV: 'production'
}
},
preprocess: {
html: {
src: 'index.tmpl',
dest: 'index.html'
}
},
hashres: {
options: {
encoding: 'utf8',
fileNameFormat: '${name}.${hash}.${ext}',
renameFiles: true
},
production: {
src: ['assets/dist/style.css','assets/dist/main.js'],
dest: 'index.html'
}
}
});
/* Public grunt tasks - to be called from command line */
grunt.registerTask('default', ['cssmin','uglify','env:'+config.environment,'preprocess','hashres']);
};
@sepehrhosseini
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment