Wrong output file name when dots are present
alex-zhuravok opened this issue · 2 comments
alex-zhuravok commented
I have 3 files in directory:
jquery.colorbox.css
jquery.fileupload-ui.css
jquery.selectbox.css
During minification they all be renamed to jquery.min.css and replaced each other, so I have only one file and it has wrong name.
JoelAlphonso commented
Same here
gongxw commented
我也遇到了同样的问题。然后,看了下源码。
在grunt的file.js中发现了如下代码:
`// The "ext" option refers to either everything after the first dot (default)
// or everything after the last dot.
var extDotRe = {
first: /(.[^\/]*)?$/,
last: /(.[^\/\.]*)?$/,
};`
`// Change the extension?
if ('ext' in options) {
destPath = destPath.replace(extDotRe[options.extDot], options.ext);
}`
所以只需要在file配置中加上 extDot: 'last'
即可。
`files: [{
expand: true,
cwd: 'out/style/',
src: ['*.css', '!*.min.css'],
dest: 'out/style',
ext: '.min.css',
extDot: 'last'
}]`
希望可以给继续使用grunt的朋友一些帮助。