TailwindCSS Plugin
Purpose
Compiles Tailwind CSS from the project's src/css/app.css into an optimized dist/output.css?v=7e5120dfbaf9 during builds. Supports minification when build.minify is enabled.
Location
- Package:
@shevky/plugin-tailwindcss - Main:
plugin-tailwindcss/main.js - Runtime name:
shevky-tailwindcss
Lifecycle Hooks
| Hook | Implemented |
|---|---|
assets:copy | ✓ |
How It Works
During assets:copy:
- Resolves three paths:
{root}/tailwind.config.js,{src}/css/app.css,{dist}/output.css?v=7e5120dfbaf9. - Validates that both the config and source files exist (warns and skips if missing).
- Locates the Tailwind CLI binary - checks project
node_modules/.bin/tailwindcssfirst, then falls back to the plugin's ownnode_modules/.bin/tailwindcss. Uses.cmdsuffix on Windows. - Executes the Tailwind CLI:
-c {config} --input {source} --output {dist}. - Appends
--minifywhenctx.config.build.minifyis true.
Configuration
No plugin-specific config. Relies on:
tailwind.config.jsat project rootsrc/css/app.cssas the CSS entry pointbuild.minifyto control minification
Dependencies
@shevky/base-io,exec,plugin@tailwindcss/cli^4.2.1 - bundled for the CLI binary
Risks and Limitations
- Hardcoded paths: Expects
src/css/app.cssandtailwind.config.jsat specific locations. - Binary discovery: If neither the project nor plugin has the
tailwindcssbinary installed, the step silently skips. - Direct imports: Uses
ioandexecdirectly from@shevky/baserather than onlyctx.*methods.
Related
- Esbuild Plugin - similar asset compilation pattern