coffeescript - grunt-contrib-coffee one-to-one compile -


i have several files named:

  • jquery.a.b.coffee
  • jquery.a.c.coffee
  • jquery.a.d.coffee

and compiled 1 jquery.js file in output directory.

although guess behavior might nice in cases, have them compile different files jquery.a.b.js, jquery.a.c.js , on. how can tell grunt-contrib-coffeescript so?

my gruntfile.js looks this:

module.exports = function (grunt) {     grunt.initconfig({         coffee: {           dist: {             files: [{               expand: true,               flatten: true,               cwd: 'app/webroot/coffee',               src: ['{,*/}*.coffee'],               dest: 'app/webroot/js',               ext: '.js'             }]           }         }     });      grunt.loadnpmtasks('grunt-contrib-coffee');  }; 

thanks help!

the problem lies on filenames having multiple dots.
if jquery-a-b.coffee, jquery-a-c.coffee etc, have seen expected output.

it known issue (extension after last period only) , grunt developers made on purpose.
here quote 1 of them:

there's 2 ways ext work; consider after first dot extension, or after last dot extension. chose former because use-case more common (we encounter .min.js files time). being said, can use rename option specify function use whatever custom naming logic need.

so, workaround remove ext , use rename this:

coffee: {   dist: {     files: [{       expand: true,       cwd: 'app/webroot/coffee',       src: ['{,*/}*.coffee'],       dest: 'app/webroot/js',       rename: function(dest, src) {         return dest + '/' + src.replace(/\.coffee$/, '.js');       }     }]   } } 

update of grunt 0.4.3:
can use extdot option along ext

ext: '.js', extdot: 'last' 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -