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

extension is after _last_ period only #750

Closed
wants to merge 1 commit into from

Conversation

Ulexus
Copy link

@Ulexus Ulexus commented Apr 3, 2013

in file.expandMapping, fix destPath replace such that only the extension
is replaced, not anything after the first '.' of the last path segment.

In other words, if the source file is 'my/dir/path/test.single.js', only
the final '.js' should be considered the extension, not '.single.js',
and only that should be replaced.

in file.expandMapping, fix destPath replace such that only the extension
is replaced, not anything after the first '.' of the last path segment.

In other words, if the source file is 'my/dir/path/test.single.js', only
the final '.js' should be considered the extension, not '.single.js',
and only that should be replaced.
@tkellen
Copy link
Member

tkellen commented Apr 3, 2013

Thanks, but if we do this we'll get PRs to put it back the other way around. You can accomplish this using rename. Also, this is a duplicate of #625 / #718 / #730.

@tkellen tkellen closed this Apr 3, 2013
@tkellen
Copy link
Member

tkellen commented Apr 3, 2013

@cowboy i think it's time we discussed a way to support both of these formats

@cowboy
Copy link
Member

cowboy commented Apr 3, 2013

I was thinking of that yesterday, actually. But it just seemed totally unnecessary since the rename function exists. It could be an additional property like extOptionReplacesAfterLastDotNotFirstDot though. Ugh.

@Ulexus
Copy link
Author

Ulexus commented Apr 3, 2013

The rename function is fine, but at a minimum, the documentation should be fixed to reflect the actual behaviour. According to http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically :

Replace any existing extension with this value in generated dest paths.

I can understand not wanting to rock the boat with current users, but as the current designed behaviour does not match the general expectation of what constitutes an "extension," the documentation should at least explicitly define its actual behaviour. Something like:

Replace anything after the first . in the filename with the specified value for ext. Note that if you have files of the form 'category.name.ext', and wish to replace only 'ext' instead of 'name.ext', you will need to use rename to explicitly declare the conversion.

@davidcl64
Copy link

@cowboy @tkellen

I added some comments to gruntjs/grunt-contrib-uglify#54

Perhaps one of the approaches there could be a way forward, or serve to help get the creative juices flowing on an alternative?

@cowboy
Copy link
Member

cowboy commented May 6, 2013

FYI, I added support for this into node-globule which will, eventually, be upstreamed back into Grunt.

@davidcl64
Copy link

That'll work. Thank you!

@SimplGy
Copy link

SimplGy commented May 22, 2013

It would be nice to change this. Is there agreement that "everything after the last dot" is the right way to calculate extension, just not agreement on the right way to migrate existing users, or is there a fundamental problem with the change request?
http://stackoverflow.com/questions/16697344/configure-grunt-file-name-matching-for-files-with-multiple-dots

@alexstrat
Copy link

@cowboy What is the status of upstreaming node-globule ? Can we use the extDot option in grunt ?

@dynamicdan
Copy link

extDot could be used for world peace! Why can't I create world peace yet? Not in grunt version "0.4.2" yet.

@cowboy
Copy link
Member

cowboy commented Jan 11, 2014

I'm actively working on globule. I hope to have a new version released soon. I can't guarantee when it will make it into Grunt however, because it may introduce backwards-incompatible changes.

For now, please use the rename option, as mentioned in my first comment here.

@tkellen
Copy link
Member

tkellen commented Mar 14, 2014

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

@Ulexus Ulexus deleted the extension_fix branch March 14, 2014 22:49
@radkodinev
Copy link

extDot is a good addition!

IMHO what would have been event better is a srcExt/stripExt option instead, effectively telling Grunt "Hey, those files that I need you to match have the extension I have happily provided for you in srcExt so strip that and replace with the extension I gave you in ext; no need for you to guess". Or as an addition to extDot - "for files ending with #{srcExt} replace it with #{ext}; for other files do as you normally do (assume the extension is everything after the #{extDot} dot)".
Or something similar, you get the idea.

@benlk benlk mentioned this pull request Apr 8, 2015
7 tasks
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

Successfully merging this pull request may close these issues.

8 participants