问题
I want to manage clientside assets using Bower which installs resources such as angular into
/vendors/assets/components/angular/angular.js
I reference these assets in the application.css.scss
file as follows:
/* ...
*= require bootstrap
*/
However while this works ok for development and the files are included ok, they're not getting picked up by sprockets for compilation in production on Heroku.
How can I instruct Sprockets to pick up and compile files from /vendor/assets/components/
?
回答1:
You should be able to tell the pipeline to include extra directories like this:
config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
You may also need to tell it to precompile specific files too, as only the main application.js & application.css are precompiled by default:
config.assets.precompile << %w( frontpage.css frontpage.js *.svg )
With Rails 4 on Heroku you need to add the 12factorapp gem
Finally, if you are using Heroku then for Rails 4 you'll need to add the following Gem
group :production do
gem 'rails_12factor'
end
See this question for more information
来源:https://stackoverflow.com/questions/19546894/how-do-you-instruct-sprockets-to-include-files-from-vendors-assets-components-o