Skip to content

Composable asset pipeline with pluggable bundler support - #7

Merged
jimsynz merged 1 commit into
mainfrom
composable-asset-pipeline
Mar 29, 2026
Merged

jimsynz merged 1 commit into
mainfrom
composable-asset-pipeline

Conversation

@jimsynz

@jimsynz jimsynz commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Refactors phx.install.assets from a monolithic task into a composable orchestrator with pluggable bundler and CSS runner subtasks
  • Adds --lang=ts option for TypeScript entry point generation
  • Tailwind CSS runner is dynamically dispatched via task naming convention (phx.install.assets.tailwind.#{bundler}), so adding a new bundler requires no changes to existing files

New flags on phx.install.assets

Flag Values Default
--bundler esbuild, none esbuild
--lang js, ts js
--tailwind boolean true

Task composition

phx.install.assets (orchestrator)
├── phx.install.assets.static
├── phx.install.assets.live_reload
├── phx.install.assets.esbuild (or other bundler)
└── phx.install.assets.tailwind
    └── phx.install.assets.tailwind.esbuild (or other bundler)

Extensibility

Adding support for a new bundler (e.g. from an external package) requires implementing two tasks:

  • phx.install.assets.<bundler_name> — JS bundling setup
  • phx.install.assets.tailwind.<bundler_name> — Tailwind CSS runner for that bundler

No changes to existing files needed.

Test plan

  • All 157 existing tests pass (0 failures)
  • New tests cover: esbuild default, --no-tailwind, --lang ts, --bundler none, custom app name, idempotency
  • mix format --check-formatted passes

Refactor `phx.install.assets` from a monolithic task into a composable
orchestrator with pluggable bundler and CSS runner subtasks.

New flags on `phx.install.assets`:
- `--bundler=esbuild|none` (default: esbuild)
- `--lang=js|ts` (default: js)
- `--tailwind/--no-tailwind` (default: true)

New subtasks:
- `phx.install.assets.static` — robots.txt + favicon
- `phx.install.assets.live_reload` — live_reload config in dev.exs
- `phx.install.assets.esbuild` — esbuild hex dep, app.js/ts, vendored topbar
- `phx.install.assets.tailwind` — app.css, dynamically composes
  bundler-specific runner via `phx.install.assets.tailwind.#{bundler}`
- `phx.install.assets.tailwind.esbuild` — tailwind hex package runner

Adding support for a new bundler requires implementing two tasks
(`phx.install.assets.<name>` and `phx.install.assets.tailwind.<name>`)
with no changes to existing files.
@jimsynz
jimsynz merged commit 984f9f2 into main Mar 29, 2026
2 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