0

This is what I currently have:

    coffee: {
        options: {
            bare: true
        },          
        glob_to_multiple: {
            expand: true,
            flatten: false,
            cwd: 'public/js',
            src: ['*.coffee'],
            dest: 'public/js',
            ext: '.js'
        }
    },

The problem is I have two directories which contain my JS files, and I don't know how to set it up to watch both places, and compile the javascript into the same directories the coffeescripts are in.

This is the coffeescript command I'm trying to replicate the functionality of: coffee --watch --compile .

Joren
  • 9,623
  • 19
  • 63
  • 104

1 Answers1

1

if I understand it correctly and you want to compile coffee into JS from two directories, there are two simple solutions for you.

First solution - compile JS file to the same directory as the original CoffeeScript file:

  coffee:
     options:
        bare: true
     compile:
        files: [
           expand: true
           src: ['js/**/*.coffee', 'other/**/*.coffee']
           dest: './'
           ext: '.js'
        ]

Second solution - compile JS file to the common directory for all coffee files.. (but it keeps the relative path, so if you have coffee/hello.coffe it is going to be placed into js/coffee/hello.js

  coffee:
     options:
        bare: true
     compile:
        files: [
           expand: true
           src: ['js/**/*.coffee', 'other/**/*.coffee']
           dest: 'js/'
           ext: '.js'
        ]

Hope it helps, otherwise you can try different settings for each directory as follows:

  coffee:
     options:
        bare: true
     compileOneDir:
        #...
     compileSecondDir:
        #...
mrtn
  • 331
  • 2
  • 12