Precompile coffeescript files (Rails 4)

In my Rails 4 application, I have a users.js.coffee file in app/assets/javascripts . It compiles and works great during the development process. But when I deploy the hero, it does not work. According to Railsguides:

Matches (and other members of the precompilation array, see below) apply to the final compiled file names. This means that everything compiled in JS / CSS is excluded, as well as raw JS / CSS files; for example, .coffee and .scss files are not automatically included when compiling in JS / CSS.

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

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

It still does not cause the file to be precompiled. Do you know how I can get Rails to precompile it (I use RAILS_ENV=production bundle exec rake assets:precompile to precompile)?

Many thanks.

+5
source share
1 answer

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

+8
source

Source: https://habr.com/ru/post/1204871/


All Articles