Autocompile .coffee files and reload the project

I have a small web service developed in node and I would like to encode some files in coffeescript to start playing with it.

I use nodemon to run an application like this

nodemon app.js 

And I have the following file structure

app.js controllers / ping.coffee test.js

The nodemon homepage says it supports coffeescript, but I am changing the file and it will not be reloaded.

Then I found this article , so I tried with

$ coffee --watch --compile ./controllers/*.coffee

And it works fine, but if I try with

$ coffee --watch --compile ./*.coffee 
File not found: ./*.coffee

So, it looks like the watch option is not recursive.

Any idea how I can make nodemon, select coffeescript file files, or select coffee compiler files recursively?

+2
3

:

coffee --watch --compile ./

, -wc.

+2

Nodemon coffeescript, -e js,coffee. , , : https://github.com/remy/nodemon/issues/312

+3

, , coffeescript. script coffeescript Javascript . , Cakefile src/ lib/. cake watch cake build , .

{print} = require 'util'
{spawn} = require 'child_process'

task 'build', 'Build lib/ from src/', ->
  coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src']
  coffee.stderr.on 'data', (data) ->
    process.stderr.write data.toString()
  coffee.stdout.on 'data', (data) ->
    print data.toString()
  coffee.on 'exit', (code) ->
    callback?() if code is 0

task 'watch', 'Watch src/ for changes', ->
  coffee_src = spawn 'coffee', ['-w', '-c', '-o', 'lib', 'src']
  coffee_src.stderr.on 'data', (data) -> process.stderr.write data.toString()
  coffee_src.stdout.on 'data', (data) -> print data.toString()

However, if you are not using node, but actually using a browser application, I would suggest using fantastic hem . For this, I also wrote a guide to get started: fooobar.com/questions/61617 / ...

+1
source

All Articles