Skip to content

Support Propshaft apps in the legacy backend - #1

Closed
markokajzer wants to merge 4 commits into
mainfrom
backend-prebuilt-assets
Closed

markokajzer wants to merge 4 commits into
mainfrom
backend-prebuilt-assets

Conversation

@markokajzer

@markokajzer markokajzer commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Rails 8 defaults to Propshaft, but solidus_backend only works with Sprockets: its JS and SCSS rely on Sprockets directives, sassc-rails, handlebars_assets and ERB, and Propshaft and sprockets-rails can't run side by side. This follows solidusio#6404 (Sprockets only belongs to the legacy backend) and the Rails main work in solidusio#6677 / solidusio#6679.

Nothing changes for Sprockets apps, and nothing is prebuilt: the host app still compiles everything.

  • Stylesheets compile under both sassc and dart-sass: plain url() instead of image-url/font-url (Sprockets still rewrites them to digested paths), themes renamed from .css.scss to .scss, and Font Awesome 4.7's SCSS vendored because font-awesome-rails only ships a .css.erb
  • Propshaft apps add dartsass-rails: the backend registers its themes as dartsass builds, so assets:precompile and dartsass:watch compile them with the app's own stylesheets
  • JavaScript needs no build step: under Propshaft, Spree::Backend::PropshaftManifest expands the //= require directives (including the app's spree/backend/all.js) into individual script tags, in the order Sprockets would have concatenated them. Handlebars templates are compiled in the browser, and spree.js.erb is rendered inline
  • solidus_core only requires sprockets/railtie when it's installed and Propshaft isn't loaded; solidus_backend skips sassc-rails under Propshaft

CI runs the backend specs on Propshaft for the Rails 8.1 / Ruby 4.0 row.

Verification

  • 107 order, customer, new order, taxon, stock management, customer return, product edit, homepage, locale and style guide feature examples pass under both Sprockets and Propshaft
  • Screenshots of orders, order edit, customer, products, taxonomy and style guide match main under both pipelines (style guide and taxonomy pixel-identical; the rest differ only in random order/SKU numbers)

Alternatives considered

  • Precompiling the backend's assets into the gem: a Node build (dart-sass, Handlebars precompile, directive resolver) writing plain JS/CSS under the same logical paths, which works with either pipeline without extra gems. Rejected because it adds a build step to Solidus's own development and release, and built output either has to be committed or is missing for apps that install from git.

Open questions

  • Propshaft apps still install sassc-rails (and with it sprockets-rails and sassc) because solidus_backend depends on them; they just aren't loaded. Make them optional?
  • The admin layout now loads around 130 individual files under Propshaft. That's the Propshaft way, but could move to importmap later.
  • The install generator still writes Sprockets-style all.js / all.css. They work under Propshaft (their directives are expanded too), but could become plain files for new Propshaft apps.
  • dart-sass deprecates @import. That's fine for now, but the backend's stylesheets will eventually need @use.

Checklist

  • I agree that my PR will be published under the same license as Solidus.
  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
  • I have localized any and all user-facing strings that I added to the source code.
  • I have used clear, explanatory commit messages.

sprockets-rails moved from solidus_core to solidus_backend in solidusio#6404, but
core still required sprockets/railtie unconditionally. The precompiled
assets test hook now also skips pipelines without precompiled_assets.
Uses plain url() instead of sassc-rails' image-url/font-url (sprockets
still rewrites them to digested paths), drops the .css.scss suffix from
the themes so they can import each other, and vendors font awesome's
scss since font-awesome-rails only ships a .css.erb.
The host app still compiles everything. Themes are registered as
dartsass-rails builds, and the sprockets directives in the javascript
manifests are expanded into individual script tags, with handlebars
templates compiled in the browser and spree.js.erb rendered inline.
@markokajzer markokajzer changed the title Ship prebuilt legacy backend assets so it works with Propshaft Support Propshaft apps in the legacy backend Oct 17, 2026
@markokajzer
markokajzer force-pushed the backend-prebuilt-assets branch from 5453c7d to 5b9e254 Compare October 17, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant