user2725109
user2725109

Reputation: 2386

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.

Upvotes: 5

Views: 1856

Answers (1)

user229044
user229044

Reputation: 239302

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

Upvotes: 8

Related Questions