Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@qstudio
Last active September 17, 2020 17:18
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 qstudio/c297b8cbf64f8dcde2fb27883bce76d2 to your computer and use it in GitHub Desktop.
Save qstudio/c297b8cbf64f8dcde2fb27883bce76d2 to your computer and use it in GitHub Desktop.
'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