This is a common question in here, but none of the solutions fixed my problem, so here it goes:
I am adding ace.js to my rails4 app, So what I did was
- Added vendor/assets/ace/ace.js
- Created vendor/assets/ace/index.js , with content
//= require ace
- Added the following to my production.rb
config.assets.precompile += %w( index.js )
config.assets.paths << Rails.root.join("vendor", "assets", "ace")
So in my layout file I have:
<%= javascript_include_tag "ace" %>
and it works just fine on dev, but when I run:
RAILS_ENV=production bundle exec rake assets:precompile
It doest not create the digest version of the ace file.
Am I missing something?
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.
rails assets:precompile is the task that does the compilation (concatenation, minification, and preprocessing). When the task is run, Rails first looks at the files in the config.assets.precompile array. By default, this array includes application.js and application.css .
rake assets:clean Only removes old assets (keeps the most recent 3 copies) from public/assets . Useful when doing rolling deploys that may still be serving old assets while the new ones are being compiled.
It is solved by adding :
config.assets.precompile += %w( index.js )
to config/application.rb
. (not config/environments/production.rb
)
Tested in Rails 4.0 beta1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With