Here are my paths so far:
assets
>fonts
>images
>stylesheets
>javascripts
>videos
I would like to bucket videos under the videos folder, but I can not seem to get them to be show up. My current assets.rb
initializer looks like:
Rails.application.config.assets.precompile += %w( layout-home.css layout-error.css layout-static-page.css layout-brand.css )
Rails.application.config.assets.precompile += %w( layout-home.js layout-static-page.js layout-brand.js )
Rails.application.config.assets.precompile += [ Dir.glob("#{Rails.root}/app/assets/videos/**/") ]
Any ideas on how to adjust this? No matter how I adjust that last line, I can not get them to pull in.
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.
rake assets:clean Only removes old assets (keeps the most recent 3 copies) from public/assets . Useful when doing rolling deploys that may still be serving old assets while the new ones are being compiled.
Sprockets is a crucial Ruby library that is used to serve and compile web assets. However, in Rails 7.0 the library becomes an optional dependency unless the application needs to use Sprockets. In such situations, the sprockets-rails gem will have to be added to the Gemfile .
Add the following to config/initializers/assets.rb
Rails.application.config.assets.paths << "#{Rails.root}/app/assets/videos"
Do not forget to restart the server after changing an initializer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With