Last active
September 17, 2020 17:18
-
-
Save qstudio/c297b8cbf64f8dcde2fb27883bce76d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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