I am trying to create a grunt task to compile coffeescript code spread across multiple files to .js files of the same name. I have the grunt coffeescript plugin and I am looking to use the "glob_to_multiple" spec that is given on this page:
https://www.npmjs.org/package/grunt-contrib-coffee.
glob_to_multiple: {
expand: true,
flatten: true,
cwd: 'path/to',
src: ['*.coffee'],
dest: 'path/to/dest/',
ext: '.js'
},
However, this grunt task does not compile .coffee files to .js files of corresponding names - for all .coffee files in a directory and its sub directories. I've been tweaking this config, for a while but I can't get it to do this. Please help.
The pattern
*.coffeewill only match files that end with.coffeein thecwdfolder. The pattern**/*.coffeewill match all files that end with.coffeerecursively in all sub folders ofcwdand thecwditself.Try the following config:
Also remove
flatten: trueif you want it to recreate the folder structure inpath/to/dest/instead of compiling all files to the single folder.