Created
February 21, 2017 13:09
-
-
Save elliotthilaire/359543ce30d47d82103b63e1d17f0843 to your computer and use it in GitHub Desktop.
Precompile assets based on controller_path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://guides.rubyonrails.org/asset_pipeline.html#controller-specific-assets | |
Dir[Rails.root.join('app/controllers/**/*_controller.rb')].each do |path| | |
controller_path = path.match(/controllers\/(.*)_controller.rb/)[1] | |
Rails.application.config.assets.precompile += ["#{controller_path}.js", "#{controller_path}.scss"] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment