Rails skip initializer for asset precompilation

I would like to skip one of my initializer files during resource precompilation. Is this possible in Rails 4? It seems that initialize_on_precompile been removed.

thanks

+5
source share
1 answer

There seems to be no way to do this in rails mode. We did 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 starting an asset: the task of precompiling

 ASSET_PRECOMPILE=1 RAILS_ENV=production bundle exec rake assets:precompile 
+1
source

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


All Articles