38
loading...
This website collects cookies to deliver better user experience
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
@apply
and @variantes
etc, you won't be able to use plugins and more...npm init -y
this command will create a package.json file for you then in your terminal again type these commands to install the packages needed for tailwindcss to work$ npm install webpack webpack-cli postcss postcss-loader css-loader tailwindcss mini-css-extract-plugin
const path=require('path')
mini-css-extract-plugin
which is a plugin we installed earlier this plugin helps us to output a standalone css file,const path=require("path");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports={
mode:"development",
main.js
and i will set it in the root directory entry: "./main.js",
@tailwind base;
@tailwind components;
@tailwind utilities;
import "styles.css"
output:{
filename:"main.js",
path: path.resolve(__dirname,"./build")
},
plugins: [new MiniCssExtractPlugin({
filename:"styles.css",
})],
mini-css-extract-plugin
to help us output a css file module:{
rules:[
{
test:/\.css$/,
use:[
MiniCssExtractPlugin.loader,
"css-loader",
"postcss-loader"
]
}
]
}
MiniCssExtractPlugin.loader
to put the css in an external css file."scripts": {
"build": "webpack --config webpack.config.js"
},
output:{
filename:"main.js",
path: path.resolve(__dirname,"./build")
},
plugins: [new MiniCssExtractPlugin({
filename:"styles.css",
})],
npm run build
again and congrats tailwind is working and you can start writing tailwind classes and designing your