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

Filenames with multiple . are truncated #50

Closed
jefferose opened this issue Nov 16, 2013 · 7 comments
Closed

Filenames with multiple . are truncated #50

jefferose opened this issue Nov 16, 2013 · 7 comments

Comments

@jefferose
Copy link

I ran this plugin for the first time and it seems to work well, except for this.

Folder contains jquery.ui.datepicker.css and jquery.ui.timepicker.css - upon completion, I end up with a file called jquery.min.css and the content is that of the datepicker (minified).

It seems that longer names are being truncated at the first . when output files are created.

@tkellen
Copy link
Member

tkellen commented Nov 16, 2013

The solution for this right now is to use rename in conjunction with expand to only strip the first segment of the file extension.

http://stackoverflow.com/questions/16697344/configure-grunt-file-name-matching-for-files-with-multiple-dots

In a future version of grunt we will support a declarative option for controlling whether the full extension or the first segment should be replaced.

/ref: gruntjs/grunt#979

@tkellen tkellen closed this as completed Nov 16, 2013
@stefanr
Copy link

stefanr commented Nov 21, 2013

Since this is obviously a desired behavior I use something like the following in my Gruntfile:

var rename = {
  ext: function(ext) {
    return function (dest, src) {
      return dest + "/" + src.replace(/(\.[^\/\.]*)?$/, ext);
    }
  },
};

... and:

files: [{
  expand: true,
  [...]
  rename: rename.ext(".min.js"),
}],

Maybe it's useful for someone.

Stefan

@ahmedelgabri
Copy link

@stefanr Thanks, that was helpful.

@langdonx
Copy link

Thanks @stefanr, surprised this wasn't the default behavior.

@jamesplease
Copy link
Member

Hey folks you should be using extdot nowadays

@langdonx
Copy link

Nice, glad I replied. The issue was pretty difficult to Google for and as you may know, reading the whole F'ing manual is quiet costly on time. This and an SO question that had the same answer was all I could find.

Thanks for the input!

@jamesplease
Copy link
Member

np @langdonx

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

6 participants