Search code examples
ruby-on-railsrubycoffeescriptguard

Guard Compile contents of dir to dirname


I'm using guard to compile coffee-scripts in a Rails 2.3.8 app.

I was previously using bistro_car bundles, so my scripts are organized in app/scripts/{bundle_name}/{bundle_files}

What I would like to do is compile all {bundle_files} to public/javascripts/{bundle_name}.js so I don't have to re-organize everything.

Any ideas on how to approach this?


Solution

  • The closest I can get using just the coffee command is

    coffee -o public/javascripts/{bundle_name}/ --join \
      --compile app/scripts/{bundle_name}/*.coffee
    

    Which will result in a JS file like app/scripts/{bundle_name}/concatenation.js. You could write a pretty simple Cakefile to iterate over all your bundles.