I'd like to skip one of my initializer files during asset precompilation. Is this possible in Rails 4? Seems like initialize_on_precompile
was removed.
thanks
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 .
Two cleanup tasks: rake assets:clean is now a safe cleanup that only removes older assets that are no longer used, while rake assets:clobber nukes the entire public/assets directory. The clean task allows for rolling deploys that may still be linking to an old asset while the new assets are being built.
There seems to be no way to do this in a rails way. We have done something like below
if ENV['ASSET_PRECOMPILE'].blank?
Airbrake.configure do |config|
config.project_id = ENV['AIRBRAKE_PROJECT_ID']
config.project_key = ENV['AIRBRAKE_PROJECT_KEY']
config.ignore_environments = %w(test development)
config.environment = Rails.env
end
end
and when running the asset:precompile task
ASSET_PRECOMPILE=1 RAILS_ENV=production bundle exec rake assets:precompile
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