I'm using grunt-bbb for a JavaScript project I'm working on. I'd love to use conditional compilation using grunt's support for UglifyJS, but I cannot seem to get it to work. I'm trying to pass a defines option to uglify task, but it doesn't seem to be working.
My grunt.js file looks like:
module.exports = function (grunt) {
grunt.initConfig({
// ... config options ...
uglify: {
"mangle": {
"defines": {"DEBUG": false}
}
},
// ... more configs ...
});
// ... custom tasks ...
grunt.registerTask("release", "default min mincss");
};
I've tried to add an except property to the mangle object as well, and that doesn't seem to work either (it still mangles the file...) UglifyJS is obviously being run, but it doesn't seem like it's getting the options passed in. I've dug through the code as well and when I console.log(grunt.config('uglify')); I get
{ mangle: { defines: { DEBUG: false } } }
which looks correct to me...
Any thoughts???
This is what currently works for me:
uglify: {
options: {
compress: {
global_defs: {
APP_DEBUG: false
}
}
}
}
putting it in the compress option works, in this case it will set APP_DEBUG=false
I got this fix from here: https://github.com/gruntjs/grunt-contrib-uglify/issues/12
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With