[英]How to pass file name/options to Grunt minifyify
I'm using the minifyify plugin as recommended by this answer but I can't seem to find any way to pass flags/options to it when used with Grunt. 我正在按照此答案的建议使用minifyify插件,但与Grunt一起使用时,似乎找不到任何将标志/选项传递给它的方法。
Here is the relevant part of my Gruntfile: 这是我的Gruntfile的相关部分:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
options: {
browserifyOptions: {
debug: true
},
exclude: [/*...all vendor packages...*/],
transform: [
'brfs',
'debowerify',
'deamdify'
]
},
app: {
files: [{
expand: true,
cwd: 'web/resources/js',
src: '**/*.js',
dest: 'web/assets/js',
ext: '.min.js',
extDot: 'last'
}],
options: {
plugin: ['minifyify']
}
}
}
});
The compiled files are appended to with //# sourceMappingURL=bundle.map
, which is incorrect. 编译后的文件附加到//# sourceMappingURL=bundle.map
,这是不正确的。 Also, the map files aren't being written to disk or generated at all. 而且,映射文件根本不会被写入磁盘或生成。
How can I pass options in so that the sourceMappingURL is the same as the file name? 如何传递选项,使sourceMappingURL与文件名相同? So for example: 因此,例如:
/web/assets/js/foo.min.js
-> /web/assets/js/foo.js.map
/web/assets/js/foo.min.js
> /web/assets/js/foo.js.map
/web/assets/js/bar.min.js
-> /web/assets/js/bar.js.map
/web/assets/js/bar.min.js
> /web/assets/js/bar.js.map
you can pass options into grunt-browserify plugins/transforms if you pass in the transform as an array with the name as first item, and the options-object as the second: 如果您将转换作为一个数组传入名称为第一项,选项对象为第二项的数组,则可以将选项传递到grunt-browserify插件/转换中:
plugin: [['minifyify', {your: 'options'}]]
for the transform option it is documented here: https://github.com/jmreidy/grunt-browserify#transform 有关转换选项的信息,请参见此处: https : //github.com/jmreidy/grunt-browserify#transform
for the plugin-option there is no documentation, but they generally work the same (see lib/runner.js
, ans search for options.plugin
) 对于plugin-option,没有文档,但它们通常是相同的(请参阅lib/runner.js
,ans搜索options.plugin
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.