2014-04-15 19:14:14 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
concat: {
|
|
|
|
options: {
|
|
|
|
process: function(src, filepath) {
|
2014-04-15 19:51:32 +00:00
|
|
|
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';
|
|
|
|
}
|
2014-04-15 19:14:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
2015-01-21 18:18:49 +00:00
|
|
|
src: ['../static/lib/**/*.js', '../static/js/**/*.js', '../static/dist/template-cache.js'],
|
2014-04-15 19:51:32 +00:00
|
|
|
dest: '../static/dist/<%= pkg.name %>.js'
|
2014-04-15 19:14:14 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
cssmin: {
|
2015-02-25 16:47:19 +00:00
|
|
|
'../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/**/*.css']
|
2014-04-15 19:58:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
uglify: {
|
|
|
|
options: {
|
2014-04-15 20:19:08 +00:00
|
|
|
mangle: false,
|
|
|
|
sourceMap: true,
|
|
|
|
sourceMapName: '../static/dist/<%= pkg.name %>.min.map'
|
2014-04-15 19:58:00 +00:00
|
|
|
},
|
2014-11-24 21:07:38 +00:00
|
|
|
js_min: {
|
2014-04-15 19:58:00 +00:00
|
|
|
files: {
|
|
|
|
'../static/dist/<%= pkg.name %>.min.js': ['../static/dist/<%= pkg.name %>.js']
|
|
|
|
}
|
|
|
|
}
|
2014-04-15 20:19:08 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
ngtemplates: {
|
|
|
|
options: {
|
|
|
|
url: function(path) {
|
|
|
|
return '/' + path.substr(3); // remove the ../
|
|
|
|
},
|
|
|
|
htmlmin: {
|
2014-07-15 18:20:42 +00:00
|
|
|
collapseBooleanAttributes: false,
|
2014-04-15 20:19:08 +00:00
|
|
|
collapseWhitespace: true,
|
|
|
|
removeAttributeQuotes: true,
|
|
|
|
removeComments: true, // Only if you don't use comment directives!
|
|
|
|
removeEmptyAttributes: true,
|
|
|
|
removeRedundantAttributes: true,
|
|
|
|
removeScriptTypeAttributes: true,
|
2014-08-14 17:47:09 +00:00
|
|
|
removeStyleLinkTypeAttributes: true,
|
|
|
|
keepClosingSlash: true // For inline SVG
|
2014-04-15 20:19:08 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
quay: {
|
2014-12-26 21:54:36 +00:00
|
|
|
src: ['../static/partials/*.html', '../static/directives/*.html', '../static/directives/*.html'
|
|
|
|
, '../static/directives/config/*.html'],
|
2014-04-15 20:19:08 +00:00
|
|
|
dest: '../static/dist/template-cache.js'
|
|
|
|
}
|
2015-02-06 22:52:09 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
cachebuster: {
|
|
|
|
build: {
|
|
|
|
options: {
|
|
|
|
format: 'json',
|
|
|
|
basedir: '../static/'
|
|
|
|
},
|
|
|
|
src: [ '../static/dist/template-cache.js', '../static/dist/<%= pkg.name %>.min.js',
|
|
|
|
'../static/dist/<%= pkg.name %>.css' ],
|
|
|
|
dest: '../static/dist/cachebusters.json'
|
|
|
|
}
|
2014-04-15 19:14:14 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-04-15 19:58:00 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
2014-04-15 19:14:14 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
2014-04-15 20:19:08 +00:00
|
|
|
grunt.loadNpmTasks('grunt-angular-templates');
|
2015-02-06 22:52:09 +00:00
|
|
|
grunt.loadNpmTasks('grunt-cachebuster');
|
2014-04-15 19:14:14 +00:00
|
|
|
|
|
|
|
// Default task(s).
|
2015-02-06 22:52:09 +00:00
|
|
|
grunt.registerTask('default', ['ngtemplates', 'concat', 'cssmin', 'uglify', 'cachebuster']);
|
2014-11-24 21:07:38 +00:00
|
|
|
};
|