Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong output file name when dots are present #298

Open
alex-zhuravok opened this issue Mar 2, 2018 · 2 comments
Open

Wrong output file name when dots are present #298

alex-zhuravok opened this issue Mar 2, 2018 · 2 comments

Comments

@alex-zhuravok
Copy link

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
Copy link

Same here

@gongxw
Copy link

gongxw commented Jan 16, 2020

我也遇到了同样的问题。然后,看了下源码。

在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的朋友一些帮助。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants