Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
module.exports = function(grunt) {
// root path to mode_modules - crude, but stable ##
var $root_path = '../../../';
// Load Tasks ##
grunt.loadTasks( $root_path+'node_modules/grunt-contrib-uglify/tasks'); // UGLIFY / Minify JS ##
// ------- configuration ------- ##
grunt.initConfig({
'config': {
// module data stored from Q ##
'q_modules': grunt.file.readJSON('q.module.json'),
'uglify': {
'module': {
'dest': 'library/asset/js/module.min.js',
'src' : '<%= config.q_modules.javascript_path %>'// loaded from /q.module.json, can include parent and child references ##
}
},
},
// ------- end config ------- ##
'uglify': {
'module': {
'options': {
'beautify': false,
'mangle': true, // allow mangling
'banner': '/*! Q Studio Modules ~~ <%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %> */\n',
'sourceMap': function(path) { return path.replace(/.js$/,".js.map")},
'sourceMapIncludeSources': true,
'compress': {
conditionals: true,
booleans: true,
unused: true,
sequences: true,
dead_code: true,
if_return: true,
join_vars: true,
drop_console: true
}
},
files:{
'<%= config.uglify.module.dest %>' : '<%= config.uglify.module.src %>'
}
}
},
});
// Development Tasks ##
grunt.registerTask( 'default', [
'uglify:module', // minify js /_source/js to /assets/js
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment