How to use Sprockets 2 with Rails 3.0.x

2019-06-26 06:39发布

问题:

I'm trying to use these gists to get Sprockets 2.0beta to work with a Rails 3.0.5 app in a similar way to how it works natively in Rails 3.1. Failing thoroughly so far--my app is finding the correct routes and files, and loading the initializer that extends Sprockets::Environment, but it's not parsing the //= require 'phu' lines in my application.js.

Can anyone enlighten me about Sprockets 2 with Rails 3.0?

回答1:

I have used the same gists as a basis, and it works fine. I have made some changes though. Maybe you can try that, see if it helps: https://gist.github.com/1112393

ps: I guess you solved it yourself since it's been a month... I personally have another problem: How to use Sprockets 2 with Rails 3.0.x (how to use precompiled assets) If you solved it already, or found another way to make this efficient on production, could you help me? Thanks.