Installs the change-detecting Bun asset builder into a Phoenix app.
Example
mix igniter.install phoenix_bun_assets
This installer bootstraps a complete Bun + TypeScript asset pipeline, replacing the default esbuild/tailwind Mix tasks. It:
- scaffolds the
assets/project —build.ts(the deterministic, change-detecting build script),package.json,tsconfig.json,tsconfig.hooks.json,.gitignore,js/app.ts, andcss/app.css— creating each file only if it does not already exist, - configures the Phoenix endpoint
watchersto runbuild.ts watchin dev, - ensures the
live_reloadpatterns watchpriv/static/**/*.{js,css,...}, - adds
assets.build/assets.deployMix aliases, - ignores the generated
assets/.build-stage/staging dir.
Any file that already exists in the target project is left untouched, so it is
safe to run against a project that already has some of these files. The
generated build.ts targets whatever entry points already exist — an existing
js/app.ts or js/app.js (and css/app.css) is reused instead of scaffolding
a competing one — so a standard Phoenix app builds without manual edits.
Bun binary
By default the installer adds the :bun dependency, which downloads and
manages the bun binary for you (via mix bun.install). If you already provide
bun another way — mise, system package manager, a
Docker base image, asdf, etc. — pass --bun system and the installer will
set up the watcher and aliases to a bun executable on your PATH instead,
adding no dependency and no :bun config.
Tailwind
Pass --tailwind to enable Tailwind CSS v4 compilation through Bun's bundler
(via the bun-plugin-tailwind plugin). The build script is built to load the
plugin, and the installer prints the bun add command for the required npm
packages.
Options
--bun- how bun is provided:managed(default, adds the:bundep and manages the binary) orsystem(assumesbunis already on yourPATH).--bun-version- the bun version to pin in config. Only used with--bun managed. Defaults to a recent stable.--tailwind- enable Tailwind CSS v4 compilation through Bun. Defaults to false.--install-deps- after installing, runbun addinassets/to fetch the npm packages (currently only Tailwind's). Off by default; when off, the installer just prints thebun addcommand for you to run yourself.