Creating grunt tasks to replicate coffeescript files inside directories and subdirectories

I am trying to create a grunt task to compile coffeescript code distributed across multiple files into .js files with the same name. I have a coffeescript grunt plugin and I'm looking to use the glob_to_multiple specification, which is shown 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 into .js files of the corresponding names - for all files. coffee in the directory and its subdirectories. I have been configuring this configuration for a while, but I cannot get it to do this. Please, help.

+4
2

*.coffee , .coffee cwd. **/*.coffee , .coffee cwd cwd.

:

glob_to_multiple: {
  expand: true,
  flatten: true,
  cwd: 'path/to',
  src: ['**/*.coffee'],
  dest: 'path/to/dest/',
  ext: '.js'
},

flatten: true, , path/to/dest/ .

+7

, !

, , dest: path/to. flatten: false.

coffee: {
  glob_to_multiple: {
      expand: true,
      flatten: false,
      cwd: '',
      src: ['server/api/**/*.coffee', 'client/app/**/*.coffee'],
      dest: '',
      ext: '.js',
      extDot: 'last'
  }
}

src:[] /, . cwd: '' dest: '' , node_modules, . js , . extDot: 'last' , myUnitTest.spec.coffee .

+2

Source: https://habr.com/ru/post/1542203/


All Articles