Closed decitrig closed 7 years ago
@fhurta can you have a look?
@thanpolas I confirm the behavior (bug). I'd remove the check for 'isMapping' at all. The null value for create_source_map
option would generate value-less parameter, which is invalid for compiler. So it could still have the special meaning of adding the '.map' suffix to the destination file name as I think it is standard naming pattern even in case of compiling all files to a single output, so this scenario could leverage from it too. ?
I'm also experiencing this :/ I only have a single js file at present and I get the following output:
Running "closureCompiler:minify" (closureCompiler) task
Executing: java -jar ./compiler.jar --js js/foo.js --js_output_file=js/foo.min.js --compilation_level ADVANCED_OPTIMIZATIONS --externs --define 'go
og.DEBUG=false' --warning_level verbose --output_wrapper "(function(){%output%})();" --create_source_map
>> Error: Command failed: Option "--create_source_map" takes an operand
My config looks like this:
module.exports = function (grunt)
{
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
config: 'config.rb',
force: true
}
}
},
closureCompiler: {
options: {
compilerFile: './compiler.jar',
checkModified: true,
compilerOpts: {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
externs: [],
define: ["'goog.DEBUG=false'"],
warning_level: 'verbose',
output_wrapper: '"(function(){%output%})();"',
create_source_map: null,
}
},
minify: {
files: [
{
expand: true,
src: ['js/*.js', '!js/*.min.js'],
ext: '.min.js'
}
]
}
},
watch: {
html: {
files: ['*.html'],
},
js: {
files: ['js/*.js', '!js/*.min.js'],
tasks: ['closureCompiler']
},
compass: {
files: ['sass/*.scss'],
tasks: ['compass'],
},
css: {
files: ['css/*.css'],
tasks: []
}
}
});
closing due to inactivity, feel free to re-open if the issue persists.
If I only have 1 src->dest mapping specified, setting create_source_map: null in compilerOpts does not generate source mappings, since isMapping (in closureCompiler.js) is set to
this.files.length > 1
. For example,will not generate source mappings; it passes an empty create_source_map flag to the compiler.