Propshaft Overview

Propshaft is a modern asset pipeline library for Rails. It's designed for an era where the web development landscape has evolved significantly. Key assumptions behind its design include:

  • Connection overhead is low: Bundling all assets into single large files to save on HTTP connections is no longer a primary concern.
  • Dedicated bundlers excel: JavaScript and CSS are often compiled by specialized Node.js-based tools (like Webpack, esbuild, or Vite) or served directly to modern browsers.
  • Bandwidth is plentiful: The need for aggressive minification is less critical than it once was, allowing for a simpler pipeline.

These factors enable Propshaft to be a dramatically simpler and faster asset pipeline compared to its predecessors like Sprockets.

What Propshaft Does

While Propshaft simplifies the asset pipeline by omitting features like transpilation, it provides a focused and powerful set of features essential for modern Rails applications:

  1. Configurable Load Path: You can register asset directories from your application, Rails engines, and gems. Propshaft treats all these registered paths as a single, unified source, making it easy to reference assets regardless of their location.

  2. Digest Stamping: For production environments, Propshaft runs a precompilation step that stamps each asset with a unique digest hash in its filename (e.g., application-a1b2c3d4.css). This allows you to serve assets with long-expiry cache headers, significantly improving performance for returning visitors. A manifest file (.manifest.json) is generated to map logical asset paths to their digested versions.

  3. Development Server: In development, there's no need to precompile assets. A built-in development server serves assets on the fly. You can use the same asset_path helpers in your views, and Propshaft handles resolving them to the correct source files.

  4. Basic Compilers: Propshaft is not a transpiler. However, it provides a simple input-to-output compiler system. By default, this is used to rewrite url() references in CSS files to point to the correct digested asset paths and to update source mapping URLs.

Getting Started

Ready to integrate Propshaft into your project? Head over to the Installation guide to get started, or follow the Quick Start tutorial for a hands-on introduction.