Deliver assets for Rails
open sourceMITself-hostablefree
Propshaft is the asset pipeline in new Rails 8 apps, replacing Sprockets. It deliberately does less: it gathers assets from a configurable load path across the app and its gems, copies them with a digest stamped into each filename so they can be cached forever, serves them in development without precompiling, and rewrites url() references in CSS to the digested paths. It leaves bundling, transpiling and minification to JavaScript bundlers or import maps, and supports Subresource Integrity.
Problems it solves
- Sprockets is slow and complicated for what our Rails app needs
- fingerprint our static files so browsers can cache them forever
- serve images, CSS and JavaScript in development without precompiling
- migrate a Rails app off Sprockets to the newer default
- add integrity hashes to our script and stylesheet tags
- reference digested asset paths from inside our CSS files
Features
- configurable load path across the app and gems
- digest stamping with a manifest for long-expiry caching
- development server without precompiling
- CSS url() rewriting to digested paths
- Subresource Integrity
- excluded paths for compiler inputs
- upgrade guide from Sprockets
Alternatives
The same job
These do what Propshaft does.
- Shakapacker Use Webpack to manage app-like JavaScript modules in Rails
