Skip to content

Serve engine CSS via tailwindcss-rails engine support - #88

Merged
thomasgallagher merged 3 commits into
mainfrom
serve-engine-css-via-tailwindcss-rails
Jun 7, 2026
Merged

Serve engine CSS via tailwindcss-rails engine support#88
thomasgallagher merged 3 commits into
mainfrom
serve-engine-css-via-tailwindcss-rails

Conversation

@thomasgallagher

Copy link
Copy Markdown
Collaborator

Replace the copy-based CSS install with tailwindcss-rails' Rails engine support: the engine's stylesheet is now imported straight from the gem, so it stays in sync with the installed version instead of being copied into the host app at install time.

  • Move app/assets/tailwind/layered/ui/styles.css to the convention path app/assets/tailwind/layered_ui/engine.css (engine_name is layered_ui)
  • Remove CopyAssetsGenerator; ImportCssGenerator now injects @import "../builds/tailwind/layered_ui";
  • Switch the engine layout to stylesheet_link_tag "tailwind" so propshaft's :app glob no longer emits a stray link to the generated intermediate file
  • Update README, gemspec post-install message, SKILL.md, AGENTS.md, dummy install docs, and CHANGELOG (flagging the breaking install-flow change)

Compiled output is byte-identical to the previous build; fonts and masked SVG icons resolve unchanged. All tests pass.

Replace the copy-based CSS install with tailwindcss-rails' Rails engine
support: the engine's stylesheet is now imported straight from the gem,
so it stays in sync with the installed version instead of being copied
into the host app at install time.

- Move app/assets/tailwind/layered/ui/styles.css to the convention path
  app/assets/tailwind/layered_ui/engine.css (engine_name is layered_ui)
- Remove CopyAssetsGenerator; ImportCssGenerator now injects
  @import "../builds/tailwind/layered_ui";
- Switch the engine layout to stylesheet_link_tag "tailwind" so propshaft's
  :app glob no longer emits a stray link to the generated intermediate file
- Update README, gemspec post-install message, SKILL.md, AGENTS.md, dummy
  install docs, and CHANGELOG (flagging the breaking install-flow change)

Compiled output is byte-identical to the previous build; fonts and masked
SVG icons resolve unchanged. All tests pass.
@claude

claude Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review

Switches the engine's CSS delivery from a copied file ( generated into the host app) to tailwindcss-rails' engine support, so the engine CSS is compiled directly from the gem on each build. The install generator, layout link tag, documentation, and tests are all updated consistently.

Issues

No issues found. A few things checked:

  • **** (layout line 23): matches tailwindcss-rails' own convention for its compiled output file; the previous Sprockets bundle could have linked the engine's intermediate build file as a side effect, so this is an improvement.
  • ****: idempotency is preserved - the new import line is checked before insertion, and the overrides import is only added when absent. The generator does not remove the now-obsolete from existing files, but the CHANGELOG migration note covers this explicitly and it is a deliberate hand-off to the developer.
  • **** in : raises on a missing gem; is a test-suite dependency via , so generator tests won't hit the guard.
  • Builds directory in CI: is gitignored and no Tailwind build step runs in CI, but the test suite is Ruby-only (no CSS compilation needed for the test cases).

Verdict

Ship - Clean, well-scoped change with thorough documentation and consistent test updates.

The engine layout now links the compiled build via
stylesheet_link_tag "tailwind", which propshaft requires to exist - unlike
the previous :app glob that silently tolerated a missing build. On a clean
checkout (e.g. CI) there is no app/assets/builds/tailwind.css, so the
integration tests raised "asset 'tailwind.css' was not found in the load
path". Make the test task depend on app:tailwindcss:build so the CSS (and
the engine entry point under builds/tailwind/) is compiled first.
@claude

claude Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review

Migrates engine CSS delivery from copying assets into the host app to using tailwindcss-rails' engine support, so the engine stylesheet stays in sync with the installed gem version automatically. Also removes the now-redundant CopyAssetsGenerator and updates all docs, tests, and the dummy app accordingly.

No issues found - the implementation is clean.

Notes (not blocking):

  • The migration guide correctly tells users to manually remove the old @import "./layered_ui"; line; the install generator does not do this automatically. That is a reasonable choice for a Rails generator, but worth verifying the CHANGELOG makes the manual step obvious. It does.
  • stylesheet_link_tag "tailwind" in the engine layout assumes the host app's tailwindcss-rails output is named tailwind.css (the framework default). Since tailwindcss-rails ~> 4.0 is a hard gem dependency, this assumption is sound.

Verdict

Ship - clean, well-tested migration with clear breaking-change documentation.

@claude

claude Bot commented Jun 6, 2026

Copy link
Copy Markdown

This PR replaces the copy-based CSS install with tailwindcss-rails' engine support, moving the engine stylesheet from app/assets/tailwind/layered/ui/styles.css to app/assets/tailwind/layered_ui/engine.css, removing CopyAssetsGenerator, and updating the engine layout to link tailwind.css directly.

No issues found. The migration guide in CHANGELOG is clear, the Rakefile task addition is correctly motivated, tests are updated throughout, and the SKILL.md/AGENTS.md/README updates are consistent with the implementation change.

Ship

@thomasgallagher
thomasgallagher merged commit 3ee706f into main Jun 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant