@hamur/tailwind
The first-party Tailwind module. It compiles Tailwind v4 with compile of @tailwindcss/node and scans your sources with Scanner of @tailwindcss/oxide, the two packages that @tailwindcss/vite and @tailwindcss/postcss are hosts over. It uses no PostCSS and has no options. The Styling page shows it with a sample; install it with the three packages it needs, as peers, and add it to modules.
bun add -d tailwindcss @tailwindcss/node @tailwindcss/oxide @hamur/tailwind
// hamur.config.ts
import tailwind from "@hamur/tailwind"
export default defineConfig({
modules: [tailwind],
})
// app/app.tsx
import { Outlet } from "@hamur/adapter-react"
import "./styles/tailwind.css"
export default function App() {
return <Outlet />
}
default
The module, as defineModule({ meta: { name: "tailwind" } }). Its setup checks the installed tailwindcss and adds the Bun plugin hamur-tailwind to the client and server builds and to both dev builds.
- The version.
tailwindcssis read from the app's root at setup. A major other than 4 fails the build with@hamur/tailwind needs tailwindcss 4; found 3.4.17; none installed fails it with@hamur/tailwind needs "tailwindcss" installed in the app.@tailwindcss/nodeand@tailwindcss/oxideare imported from the app's root when the first stylesheet loads; without one, the build fails with@hamur/tailwind needs "@tailwindcss/oxide" installed in the app. - Which files. A
.cssfile that importstailwindcssor uses@apply,@theme,@source,@utility,@variant,@custom-variant,@pluginor@config. Every other.cssfile is loaded by Bun as it is, byte for byte. - The output. The compiled CSS goes back to Bun, which bundles and minifies it, so the module runs no
optimizepass. The server build carries no CSS. - The sources. The compiler names them:
@sourceand@source notin the CSS, and the app's root by default, without the build and output directories. - In
hamur dev. A change to a source file that adds a class builds the stylesheet again and the page takes it with no restart and no reload. A class that an edit removes stays until the stylesheet changes orhamur devrestarts.