small medium large xlarge

Back to: All Forums  CoffeeScript
28 Jul 2015, 22:56
Brian McMillin (2 posts)

Greetings -

There are two places where setup for Grunt is described: printed pages 50 and 72. Both show

$ mkdir coffee-tasks
$ cd coffee-tasks
$ npm init

although the two project directories should be jQuery and Node. This causes a certain amount of confusion.

The more serious problem seems to be a conflict with the semantics of src in the project directory structure.

When you run grunt from the command line it magically finds something called Gruntfile.* and figures out that needs to be processed as coffeeScript. It then attempts to process into javaScript and place the results in a file called src. However, the project directory structure uses src/ as a folder for all coffeeScript files.

Why would the coffee processing output of be called src? What controls this? Why isn’t it Gruntfile.js?

$ grunt
Running "coffee:compile" (coffee) task
>> 0 files created.

Running "coffee:cwd" (coffee) task
Warning: Unable to read "src/" file (Error code: EISDIR). Use --force to continue.

Aborted due to warnings.

Furthermore, if you use grunt - -force grunt works as expected for everything except coffeeScript files in src/. I.e., it processes eco files and places the results in compiled/, it uses watch to look for changes, and it discovers changes to src/*.coffee files, but (silently) fails to write anything to compiled/.

>> File "src/" changed.
Running "coffee:compile" (coffee) task
>> 0 files created.

Done, without errors.
Completed in 0.523s at Tue Jul 28 2015 09:03:26 GMT-0500 (CDT) - Waiting...

Any suggestions? What am I missing?

29 Jul 2015, 12:19
Brian McMillin (2 posts)


I will leave this post as a cautionary tale

It seems that this problem was caused by allowing a TAB character to seep into the

Since coffeeScript is sensitive to whitespace you must ALWAYS ensure that your editor does not mix spaces and tab characters. And if you import a file, or cut-and-paste, ALWAYS be sure you haven’t created a hidden problem.

The code LOOKED good on the screen, but the tab size in the editor and the default tab size used by coffeeScript were different. Thus, the indentation seen by the transcoder made the resulting code behave in a totally unexpected manner.

Also, one should always use an editor with an on-the-fly linter. This will help to prevent problems all around, but bear in mind that lint (or the transcoder, for that matter) cannot catch all errors and did not raise even a hint that something might have been wrong in this case.

Failure to recognize that TABs are always lurking in the woods can lead to REALLY OBSCURE problems.

Be extra diligent.


You must be logged in to comment