ChrisWren / grunt-nodemon

Grunt task to run nodemon
MIT License
345 stars 37 forks source link

Crash! Shouldn't files ending in ".coffee" be started with the command "coffee", not "node"? #9

Closed zakdances closed 11 years ago

zakdances commented 11 years ago

grunt-nodemon crashed because it incorrectly tries to start my .coffee file with the wrong command. Should be

coffee app.coffee

not

node app.coffee
ChrisWren commented 11 years ago

Just ran grunt-nodemon with the following config pointing at a coffee-script server file:

nodemon: {
  prod: {
    options: {
      file: 'server.coffee'
    }
  }
}

This is the outputted command in the terminal:

8 Jun 12:49:06 - [nodemon] starting coffee server.coffee

It worked fine for me, so unless you can provide a specific example of how it failed, I will close the issue.

zakdances commented 11 years ago

Using the same code as you but with more options. My output:

14:53:38 - [nodemon] starting `node server.coffee`
zakdances commented 11 years ago

Wait a minute...one of the options is causing it to fail. I'm testing now...

zakdances commented 11 years ago

@ChrisWren If you could, please try with this option:

watchedExtensions: ['coffee']

I believe that is causing the failure. I should add I'm using a Gruntfile.coffee.

zakdances commented 11 years ago

Here's my whole grunt-nodemon block.

    nodemon:
      dev:
        options:
          file: 'server.coffee'
          watchedExtensions: ['coffee']
          watchedFolders: ['/','/public/js']
          delayTime: 1

Are you still getting the correct coffee command with this exact setup?

ChrisWren commented 11 years ago

This is a bug with nodemon, I am looking into a pull request to solve it. You actually don't have to specify .coffee as an extension as nodemon looks at it by default as seen in this line of the nodemon source. I just updated the README for grunt-nodemon.

zakdances commented 11 years ago

@ChrisWren Yup, I just came to the same conclusion after recreating the grunt-nodemon generated command directly in the terminal.

zakdances commented 11 years ago

@ChrisWren any luck with the bugfix?

ChrisWren commented 11 years ago

After further review, I realised that when you use watchedExtensions and don't specify .coffee or .litcofee, it won't run your server via coffee-script. This seems pretty reasonable as it makes the option more flexible by not using the default file extensions when you want to watch custom extensions. I can't think of a reason for not listing .coffee files in your watchedExtensions list when running a coffee-script server.

I will update the grunt-nodemon docs to be more explicit about how this works. Thanks for pointing this out!