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

expand mode clobbers destination files with same name / different extensions #979

Closed
tkellen opened this issue Nov 13, 2013 · 5 comments
Closed
Labels
Milestone

Comments

@tkellen
Copy link
Member

tkellen commented Nov 13, 2013

One more reason to finish getting node-globule upstreamed.

gruntjs/grunt-contrib-compress#70

@stefanr
Copy link

stefanr commented Nov 13, 2013

I think a solution to this problem would be to change

destPath = destPath.replace(/(\.[^\/]*)?$/, options.ext);

to

destPath = destPath.replace(/(\.[^\/\.]*)?$/, options.ext);

in lib/grunt/file.js.

@dynamicdan
Copy link

Ok, this is a serious issue. I just lost 45 mins because I was searching for the magical (non-existent) dest glob (think $1 or %1) substitution solution.

My scenario:
I'm using compass/sass to output 3 css files (screen.css, print.css, ie.css) and then compress them (screen.css.gz, print.css.gz, ie.css.gz) using grunt-contrib-compress. This was fine in my first attempt where all files existed in their own build/ dir but that screwed up all relative image paths used in the CSS so I decided to be smart and use build.screen.css -> PROBLEM...

According to this http://stackoverflow.com/questions/16697344/configure-grunt-file-name-matching-for-files-with-multiple-dots the decision made with extensions (ext) that everything after the first dot is the extension killed me. Changing the input files to build-screen.css fixed the problem but this is not ideal.

I just found "extDot"..
Change the behavior of ext, "first" and "last" will remove anything after the first or last . in the destination filename, respectively. Defaults to "first".
#750 (comment) seems to reference some pressure to use this but I don't know anything about this upstreaming stuff.

@vladikoff
Copy link
Member

@tkellen Setting this for 0.5.0, assuming that node-globule fixes this issue.

@tkellen
Copy link
Member Author

tkellen commented Jan 28, 2014

It does.

@vladikoff vladikoff modified the milestones: 0.4.3, 0.5.0 Mar 6, 2014
@cowboy cowboy closed this as completed in e08e4df Mar 6, 2014
jamesplease pushed a commit to jamesplease/grunt that referenced this issue Mar 12, 2014
* Can be 'first' or 'last' but defaults to 'first'.
jamesplease pushed a commit to jamesplease/grunt that referenced this issue Mar 12, 2014
* Can be 'first' or 'last' but defaults to 'first'.
@tkellen
Copy link
Member Author

tkellen commented Mar 14, 2014

This has been resolved with the extDot option. See:
http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

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

No branches or pull requests

4 participants