What is the best way to remove asserts (console.assert
) from JavaScript code for production version? Maybe there is some software that can be configured to sort of build JavaScript and remove asserts?
UPDATE __________________________
I've installed GRUNT and groundskeeper plugin. This is what my Gruntfile.js has:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
groundskeeper: {
compile: {
files: {
'calculator/add.js': 'calculator/add.js'
},
options: {
console: false
}
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-groundskeeper');
The problem is with when I run grunt groundskeeper
I get the following error:
Running "groundskeeper:compile" (groundskeeper) task
Warning: Line 2: Invalid left-hand side in assignment Use --force to continue.
I assume that the problem is with this line:
'calculator/add.js': 'calculator/add.js'
Since if I replace it with the following:
'path/to/result.js': 'path/to/source.js'
Everything works fine:
Running "groundskeeper:compile" (groundskeeper) task
>> File path/to/result.js created empty, because its counterpart was empty.
>> 1 files read, 0 cleaned.
What's wrong with the my original line?