Answer the question
In order to leave comments, you need to log in
Ruby on Rails 4 - how to create your own path to assets?
Good day, gentlemen.
There is a need to create a path to assets in the following format
app/assets/backend/(images, stylesheets, javascripts)
app/assets/frontend/(images, stylesheets, javascripts) Added to
config/application.rb:
config.assets.paths << "#{Rails.root}/app/assets/backend/stylesheets"
config.assets.paths << "#{Rails.root}/app/assets/backend/javascripts"
config.assets.paths << "#{Rails.root}/app/assets/backend/images"
config.assets.paths << "#{Rails.root}/app/assets/frontend/stylesheets"
config.assets.paths << "#{Rails.root}/app/assets/frontend/javascripts"
config.assets.paths << "#{Rails.root}/app/assets/frontend/images"
Answer the question
In order to leave comments, you need to log in
rake RAISL_ENV=production assets:precompile ?
and restart passenger or whatever your rails stack serves in production,
for example:
touch ./tmp/restart.txt
Also delete all compiled files before
you need to add everything to config/initializers/assets.rb
Rails.application.config.assets.precompile += %w( some-js-file.js )
Rails.application.config.assets.precompile += %w( some -js-file.js ) -then-css-file.css )
and add paths above
# Add additional assets to the asset load path
Rails.application.config.assets.paths << "#{Rails.root}/app/assets/backend/stylesheets" Rails.application.config.assets.paths << "#{Rails.root}/app/assets/backend/javascripts" Rails.application.config.assets.paths <<"#{Rails.root}/app/assets/ backend/images"
Rails.application.config.assets.paths << "#{Rails.root}/app/assets/frontend/stylesheets"
Rails.application.config.assets.paths << "#{Rails.root}/app/assets/frontend/javascripts"
Rails.application.config.assets.paths << "#{Rails.root}/app/assets/frontend/images"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question