@roots/bud-tailwindcss
TailwindCSS support can be added by installing the @roots/bud-tailwindcss extension.
Installation​
- npm
- Yarn
- pnpm
npm install @roots/bud-tailwindcss --save-dev
yarn add @roots/bud-tailwindcss --dev
pnpm add @roots/bud-tailwindcss --save-dev
Configuration​
By default the bud.js tailwind implementation requires no configuration.
If you wish to customize the tailwind configuration you can create a tailwind config file.
bud.js allows for you to write your tailwind config in CommonJS, ESM, TypeScript, JSON or YML. This file should be placed in the root of your project or the project ./config
directory.
Configuring tailwind with bud.tailwind
​
You can configure tailwind directly in your bud configuration file using bud.tailwind.setConfig
.
bud.tailwind.setConfig({
content: [bud.path(`@src/**/*.{ts,php}`)],
theme: {},
plugins: [],
})
bud.tailwind.setConfig
is just one method available to help you configure tailwindcss.
Set content​
You can set the tailwindcss content
option with bud.tailwind.setContent
.
bud.tailwind.setContent([bud.path(`@src/**/*.{ts,php}`)])
Set theme​
You can set the tailwindcss theme
option with bud.tailwind.setTheme
.
bud.tailwind.setTheme({
colors: {primary: `#000000`},
})
Extend theme​
You can extend the tailwindcss theme
option with bud.tailwind.extendTheme
.
bud.tailwind.extendTheme({
colors: {primary: `#000000`},
})
This is usually preferred over bud.tailwind.setTheme
as it will merge your theme with the default tailwindcss theme.
Set plugins​
You can set the tailwindcss plugins
option with bud.tailwind.setPlugins
.
import forms from '@tailwindcss/forms'
export default async bud => {
bud.tailwind.setPlugins([forms])
}