netzpirat/haml-coffee

CLI haml-coffee not working when using --input with a folder on Windows

Closed this issue · 1 comments

Folder structure:

C:\testing>dir /s
 Directory of C:\testing

06/16/2013  06:58 PM                 0 chau.hamlc
06/16/2013  06:58 PM                 0 hola.hamlc
06/16/2013  07:10 PM    <DIR>          subfolder

 Directory of C:\testing\subfolder

06/16/2013  07:09 PM                 0 im_in_subfolder.hamlc

Failing example:

C:\testing>haml-coffee --input .
  [Haml Coffee] Compiling directory .
  [Haml Coffee] Compiling file . to chau.jst

C:\testing>

As the above example shows, It only compiles one file when having more than one.

It's a known issue of node-findit that it can't traverse folders on Windows (https://github.com/substack/node-findit/issues/5#ref-issue-14717884). Fortunately, there is an API compatible alternative to findit called walkdir (https://github.com/soldair/node-walkdir).

Installing walkdir and changing line 4 in command.coffee to findit = require 'walkdir' seems to fix this:

C:\testing>haml-coffee --input .
  [Haml Coffee] Compiling directory .
  [Haml Coffee] Compiling file . to C:\testing\chau.jst
  [Haml Coffee] Compiling file . to C:\testing\hola.jst
  [Haml Coffee] Compiling file . to C:\testing\subfolder\im_in_subfolder.jst

Thanks in advance

Thanks a lot! I wish all issues were like this.