GAURAV VARMA
Rails 8 introduces Propshaft as the new default asset pipeline, replacing the long-standing Sprockets system that powered asset management in Rails for more than a decade.
Sprockets served Rails well, but modern frontend workflows increasingly rely on tools like ESBuild, Bun, Rollup, and Vite for bundling JavaScript and CSS. Propshaft embraces this shift by providing a much simpler asset pipeline that focuses on serving and digesting assets rather than compiling them.
This change reflects Rails’ evolving philosophy: let dedicated tools handle bundling while Rails focuses on serving assets efficiently.
What is Propshaft?
Propshaft is a lightweight asset pipeline that focuses on two main responsibilities:
- Serving static assets
- Generating digested filenames for cache busting
Unlike Sprockets, Propshaft does not attempt to bundle or transpile assets. Instead, it assumes developers will use modern build tools for that job.
This results in a much simpler pipeline.
Why replace Sprockets?
Sprockets historically handled many responsibilities:
- concatenation
- minification
- preprocessing
- asset dependency graphs
Modern JavaScript ecosystems already solve these problems with specialized tooling.
Propshaft removes this duplication and allows Rails apps to integrate cleanly with modern frontend tools. Modern Rails applications also benefit from new database-backed infrastructure like Solid Cache for caching and Solid Queue for background jobs.
Benefits include:
- simpler configuration
- faster asset compilation
- better compatibility with modern bundlers
- easier debugging
Basic asset structure
With Propshaft, assets typically live in:
1app/assetsExample structure:
1app/assets
2├── stylesheets
3│ └── application.css
4├── images
5└── buildsFiles in this directory are served directly and fingerprinted for caching.
Referencing assets in views
Propshaft still provides the familiar Rails helpers:
1<%= stylesheet_link_tag "application" %>
2<%= javascript_include_tag "application" %>Rails automatically adds fingerprinted versions of the files in production.
Using modern bundlers
Propshaft works well with modern build tools.
For example, you might bundle JavaScript using ESBuild:
1npm install esbuildThen output compiled files into:
1app/assets/buildsPropshaft simply serves the generated assets.
Real-world use cases
Propshaft is ideal for Rails applications using modern frontend setups:
- ESBuild or Bun bundling
- Tailwind CSS builds
- Vite-powered frontend apps
- minimal JavaScript apps
By separating bundling from asset serving, Rails keeps the pipeline simple and flexible.
Links
Summary
Propshaft modernizes Rails asset management by simplifying the asset pipeline and embracing modern JavaScript tooling. By replacing Sprockets with a lighter system, Rails 8 makes frontend integration faster, simpler, and easier to maintain.