@tailwindcss/webpack
v4.2.0
Published
A webpack loader for Tailwind CSS v4.
Readme
@tailwindcss/webpack
A webpack loader for Tailwind CSS v4.
Installation
npm install @tailwindcss/webpackUsage
// webpack.config.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = {
plugins: [new MiniCssExtractPlugin()],
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', '@tailwindcss/webpack'],
},
],
},
}Then create a CSS file that imports Tailwind:
/* src/index.css */
@import 'tailwindcss/theme';
@import 'tailwindcss/utilities';Options
base
The base directory to scan for class candidates. Defaults to the current working directory.
{
loader: '@tailwindcss/webpack',
options: {
base: process.cwd(),
},
}optimize
Whether to optimize and minify the output CSS. Defaults to true in production mode.
{
loader: '@tailwindcss/webpack',
options: {
optimize: true, // or { minify: true }
},
}