Grunt general config
Grunt general config file not for use, just for reference.
by Rishi Kumar
JavaScript
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: 8000,
}
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= inspinia.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= inspinia.dist %>'
}]
}
}
uglify: {
options: {
banner: '/**\n @author: Rishi Kumar \n' +
' @app: <%= pkg.name %>-v<%= pkg.version%> \n' +
' @date: <%= grunt.template.today("dd-mm-yyyy") %> \n */',
compress: {
drop_console: false,
},
mangle: false
},
common_modules: {
options: {
beautify: true
},
files:{
"<%= pkg.destPath %>/dist/<%= pkg.sourceModuleName %>.min.js": ["<%= pkg.srcScriptPath %>/appCommon/**/*.js"],
},
},
script_files: {
options: {
beautify: true
},
files: [{
expand: true,
src: ['<%= pkg.srcModulePath %>/**/*.js'],
dest: '<%= pkg.destPath %>',
cwd: '.',
rename: function (dst, src) {
// To keep the source js files and make new files as `*.min.js`:
return dst + '/' + src.replace('.js', '.js');
// Or to override to src: return src;
}
}]
}
},
watch: {
scripts: {
files:["<%= pkg.srcScriptPath %>/appCommon/**/*.js"],
tasks:["uglify:common_modules"],
options: {
spawn: false,
...