Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

precompile coffeescript files ( Rails 4 )

In my Rails 4 app I have a users.js.coffee file in app/assets/javascripts. It compiles and works fine in development. But when I deploy to heroku it's not working. According to Railsguides:

The matcher (and other members of the precompile array; see below) is applied to final compiled file names. This means anything that compiles to JS/CSS is excluded, as well as raw JS/CSS files; for example, .coffee and .scss files are not automatically included as they compile to JS/CSS.

So I added the following line to my config/environments/production.rb

config.assets.precompile += %w ( users.js.coffee )

It's still not forcing the file to be precompiled. Do you know how I may force Rails to precompile it (I use RAILS_ENV=production bundle exec rake assets:precompile to precompile)?

Thanks a lot.

like image 313
user2725109 Avatar asked Oct 16 '14 22:10

user2725109


1 Answers

Your config.assets.precompile should contain users.js, not users.js.coffee.

like image 170
meagar Avatar answered Sep 28 '22 18:09

meagar