0

I'm trying to make and distribute a Ruby Gem where I package CoffeeScript files for use in other applications.

It works fine in most Sprockets apps, but when I try to include it in a Rails App I get:

undefined method `append_path' for Sprockets:Module

The error is from this line:

::Sprockets.append_path File.join(root_dir, "source")

How come when using the gem in a Rails app Sprockets has no append_path method? Is there a way to get Rails apps look in a specific directory for asset files?

I don't want to put my files in app/assets/javascripts because this is an assets only app and burying them like that just to accomodate Rails is aesthetically displeasing.

Daniel X Moore
  • 14,637
  • 17
  • 80
  • 92

2 Answers2

1
class Engine < ::Rails::Engine
  config.paths['app/assets'] = "source"
end
Daniel X Moore
  • 14,637
  • 17
  • 80
  • 92
0

Which version of rails are you using. Sprockets has been included in rails.

check out http://guides.rubyonrails.org/asset_pipeline.html

RoRRe
  • 291
  • 2
  • 10
  • Rails 3.2.11. The Sprockets module exists, but it doesn't respond to append_path like it does in Sprockets apps outside of Rails. – Daniel X Moore Mar 12 '13 at 17:46