I have a rails 3.1 application that allows users to upload pictures. Should these pictures be stored as assets(in app/assets) and therefore be subject to Sprocket overhead(caching, fingerprinting, etc.)? Or should I keep them in public/images and store them outside of the asset pipeline?
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.
By default, Rails uses CoffeeScript for JavaScript and SCSS for CSS. DHH has a great introduction during his keynote for RailsConf. The Rails asset pipeline provides an assets:precompile rake task to allow assets to be compiled and cached up front rather than compiled every time the app boots.
rails assets:precompile is the task that does the compilation (concatenation, minification, and preprocessing). When the task is run, Rails first looks at the files in the config.assets.precompile array. By default, this array includes application.js and application.css .
The asset/image is IMHO for structural/design images (background, icons, banners etc). Dynamically added pictures/assets should go in the public directory.
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