RailsCasts Pro episodes are now free!

Learn more or hide this

Sébastien Saunier's Profile

GitHub User: ssaunier

Site: http://sebastien.saunier.me

Comments by Sébastien Saunier

Avatar

I recently wrote an article about how to set up Angular in Rails, making Karma aware of the assets pipeline.

The magic is basically in a rake task:

ruby
sprockets = Rails.application.assets
sprockets.append_path Rails.root.join("spec/karma")
files = Rails.application.assets.find_asset("application_spec.js").to_a.map {|e| e.pathname.to_s }

with the karma configuration being:

javascript
files: [
  APPLICATION_SPEC,
  'app/assets/javascripts/angular/*/*.{coffee,js}',
  'spec/javascripts/**/*_spec.{coffee,js}'
]

More info: http://sebastien.saunier.me/blog/2014/02/04/angular--rails-with-no-fuss.html