File Watcher for CoffeeScript with subdirectories

Hi

I'm trying to get a File Watcher to work in WebStorm but I'm pulling my hair out. This is my project structure (I hope this comes out alright).

coffee\

classes\

class.coffee

scripts.coffee
public\

js\

classes\

  class.js

scripts.js


So, I have my coffee files in a coffee directory, with subdirectories, and I want them to compile into public/js, with the same subdirectory structure. This is easy on the command line:

coffee -cw -o public/js coffee

but for the life of me, I can't work out how to use a File Watcher and preserve the subdirectories within the coffee directory. I think the macro $FileParentDir$ might help, but I can't find any documentation on how to use it's optional parameter.


Michael

4 comments
Comment actions Permalink

Hello!

Please try the following:

Program: path to your coffeescript 1.6.* script
Arguments: --output $ProjectFileDir$/public/js/$FileDirPathFromParent(coffee)$ --compile --map $FileName$
Working directory: $FileDir$
Output paths: $ProjectFileDir$/public/js/$FileDirPathFromParent(coffee)$/$FileNameWithoutExtension$.js:$ProjectFileDir$/public/js/$FileDirPathFromParent(coffee)$/$FileNameWithoutExtension$.map

1
Comment actions Permalink

That's brilliant, Elena. That's exactly what I wanted.

Many thanks.

0
Comment actions Permalink

It would be nice to have such setup in the documentation as an example so that we wouldn't have to google for it. This is the typical setup as a developer needs to have a structure in her files and wants typically only the transpiled *.js files uploaded to hosting service, so having them in a separate directory is a must. And admittedly Elena's setup isn't trivial at all... (I spent an hour trying to figure it out using the documentation without any success whatsoever.)

0

Please sign in to leave a comment.