80 lines
No EOL
2.3 KiB
JavaScript
80 lines
No EOL
2.3 KiB
JavaScript
module.exports = function(grunt) {
|
|
|
|
// Project configuration.
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
concat: {
|
|
options: {
|
|
process: function(src, filepath) {
|
|
var unwraps = ['/js/'];
|
|
|
|
var shouldWrap = true;
|
|
for (var i = 0; i < unwraps.length; ++i) {
|
|
if (filepath.indexOf(unwraps[i]) >= 0) {
|
|
shouldWrap = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (shouldWrap) {
|
|
return '// Source: ' + filepath + '\n' +
|
|
'(function() {\n' + src + '\n})();\n';
|
|
} else {
|
|
return '// Source: ' + filepath + '\n' + src + '\n\n';
|
|
}
|
|
},
|
|
},
|
|
build: {
|
|
src: ['../static/lib/**/*.js', '../static/js/*.js', '../static/dist/template-cache.js'],
|
|
dest: '../static/dist/<%= pkg.name %>.js'
|
|
}
|
|
},
|
|
|
|
cssmin: {
|
|
'../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/*.css']
|
|
},
|
|
|
|
uglify: {
|
|
options: {
|
|
mangle: false,
|
|
sourceMap: true,
|
|
sourceMapName: '../static/dist/<%= pkg.name %>.min.map'
|
|
},
|
|
js_min: {
|
|
files: {
|
|
'../static/dist/<%= pkg.name %>.min.js': ['../static/dist/<%= pkg.name %>.js']
|
|
}
|
|
}
|
|
},
|
|
|
|
ngtemplates: {
|
|
options: {
|
|
url: function(path) {
|
|
return '/' + path.substr(3); // remove the ../
|
|
},
|
|
htmlmin: {
|
|
collapseBooleanAttributes: false,
|
|
collapseWhitespace: true,
|
|
removeAttributeQuotes: true,
|
|
removeComments: true, // Only if you don't use comment directives!
|
|
removeEmptyAttributes: true,
|
|
removeRedundantAttributes: true,
|
|
removeScriptTypeAttributes: true,
|
|
removeStyleLinkTypeAttributes: true
|
|
}
|
|
},
|
|
quay: {
|
|
src: ['../static/partials/*.html', '../static/directives/*.html'],
|
|
dest: '../static/dist/template-cache.js'
|
|
}
|
|
}
|
|
});
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
grunt.loadNpmTasks('grunt-angular-templates');
|
|
|
|
// Default task(s).
|
|
grunt.registerTask('default', ['ngtemplates', 'concat', 'cssmin', 'uglify']);
|
|
}; |