Rails 4 - Where do vendor assets go? -


after this commit in rails, suggested 3rd party assets should either put in app/assets folder or config.precompile should list such assets.

quoting use case on thread

for example, if need vendor jquery plugin has css, font face, , image sprite, i'd add .js , .css vendor/assets/javascripts , vendor/assets/stylesheets. vendor sprites , fonts in vendor/assets/images , vendor/assets/fonts, respectively. adding entire vendor/assets path seems overkill, manually specifying each asset individually seems tedious (though might design).

adding third party assets inside app/assets lead rails 2 like problem of global assets folder.

am missing ? whats rails 4 way of organizing third party assets.

third parties should included hand explicitly. because these libraries have many optional parts such source code, readme files etc. if need other things such images or fonts can add files in public folder or this:

config/application.rb

config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif, "fontawesome-webfont.ttf", "fontawesome-webfont.eot", "fontawesome-webfont.svg", "fontawesome-webfont.woff")  config.assets.precompile << proc.new |path|   if path =~ /\.(css|js)\z/     full_path = rails.application.assets.resolve(path).to_path     app_assets_path = rails.root.join('app', 'assets').to_path     if full_path.starts_with? app_assets_path       puts "including asset: " + full_path       true     else       puts "excluding asset: " + full_path       false     end   else     false   end end 

environment/production.rb

config.serve_static_assets = true 

then run bundle exec rake assets:precompile rails_env=production.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -