Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Grunt File Name Matching for Files with Multiple Dots

Tags:

I just started using grunt, and love it. I keep running into an issue that seems like it might be pretty common. Here it is. I have files named so that words after a dot are something like classes. eg:

layout.coffee layout.blog.coffee layout.site.coffee 

My grunt task is configured to watch these files and translate them to js like this:

coffee:   dev:     files: [       expand: true       cwd: "<%= yeoman.app %>"       src: ["**/*.coffee"]       dest: "<%= yeoman.dev %>"       ext: ".js"     ] 

The problem, I think, is that using ext makes the target for all three .coffee files the destination file layout.js, which isn't the intention.

Is there a nice way to configure grunt file mapping for filenames with multiple dots?

Right now I have to change my naming convention to use - instead of ., which is a drag :(

like image 259
SimplGy Avatar asked May 22 '13 16:05

SimplGy


1 Answers

Note that there is another option "extDot" that you can use to specify after which dot the ext should apply (first or last):

E.g.

files: [{   expand: true,   src: ['*.js','!*min.js'],   dest: 'js',   cwd: 'js',   ext: '.min.js',   extDot: 'last' }] 
like image 64
ViniH Avatar answered Oct 13 '22 02:10

ViniH