jwhitley / requirejs-rails

RequireJS support for your Rails 3 or 4 application
MIT License
592 stars 201 forks source link

Custom modules break with sprockets-rails 2.2.0 (rails 4.1.6) #195

Closed anselmbradford closed 10 years ago

anselmbradford commented 10 years ago

In development with custom modules (see https://github.com/codeforamerica/ohana-web-search/blob/master/config/requirejs.yml#L13-L17), sprockets complains about the assets not being precompiled:

screen shot 2014-10-13 at 5 02 30 pm

See https://github.com/codeforamerica/ohana-web-search/blob/master/config/environments/development.rb for development settings. I've tried adding config.assets.digest = true with no luck.

carsomyr commented 10 years ago

@anselmbradford Not our problem. See this policy change.

anselmbradford commented 10 years ago

Requirejs call in layout looks like requirejs_include_tag("routes/#{controller_name}/#{action_name}")

carsomyr commented 10 years ago

@anselmbradford Well yeah, but you still have to add in the config.assets.precompile list manipulation, because the Rails people want to prevent surprises in production.

anselmbradford commented 10 years ago

@carsomyr Thanks for the quick response. What's the recommended config for a requirejs-rails deploy in respect to this policy change?

anselmbradford commented 10 years ago

Sorry, that earlier comment was out of sync :D posted before I saw your comment. So add:

Rails.application.config.assets.precompile += %w(routes/home/index.js routes/about/index.js routes/locations/index.js routes/locations/show.js)

To assets.rb?

carsomyr commented 10 years ago

@anselmbradford Yes.

anselmbradford commented 10 years ago

@carsomyr Cool, thank you. This would suggest https://github.com/jwhitley/requirejs-rails#avoid-configassetsprecompile needs to be updated? Is the approach to per route modules I'm using in the project shown seem correct?

csjohn commented 8 years ago

Is @anselmbradford's last comment (Oct 13, 2014) correct? Is the README section about avoiding config assets precompile out of date?