如何使用 grunt-closurecompiler 动态创建源映射
How to create source maps dynamically with grunt-closurecompiler
我无法让它工作。 name_of_current_file
需要以某种方式替换为正在处理的当前文件的名称。在我看来,选项 属性 只评估一次并为每个文件重复使用。
closurecompiler: {
dev: {
files:[{
expand: true,
flatten: true,
cwd: 'www',
src: ['src/js/*.js', '!src/js/*.min.js'],
dest: 'www/build/js/',
ext: '.min.js',
}],
options: {
// Any options supported by Closure Compiler, for example:
"compilation_level": "ADVANCED_OPTIMIZATIONS",
"create_source_map": name_of_current_file+'.map',
// Plus a simultaneous processes limit
"max_processes": 4,
}
},
}
您可以在源映射命名中使用替换变量 %outname%
。
"create_source_map": '%outname%.map'
此外,请确保您使用的是 officially supported Grunt Plugin。
我无法让它工作。 name_of_current_file
需要以某种方式替换为正在处理的当前文件的名称。在我看来,选项 属性 只评估一次并为每个文件重复使用。
closurecompiler: {
dev: {
files:[{
expand: true,
flatten: true,
cwd: 'www',
src: ['src/js/*.js', '!src/js/*.min.js'],
dest: 'www/build/js/',
ext: '.min.js',
}],
options: {
// Any options supported by Closure Compiler, for example:
"compilation_level": "ADVANCED_OPTIMIZATIONS",
"create_source_map": name_of_current_file+'.map',
// Plus a simultaneous processes limit
"max_processes": 4,
}
},
}
您可以在源映射命名中使用替换变量 %outname%
。
"create_source_map": '%outname%.map'
此外,请确保您使用的是 officially supported Grunt Plugin。