目录
一、tailwindcss基本使用
1、设置tailwind和postcss
- 命令
* npm init -y
* npm i tailwindcss postcss-cli autoprefixer
* npx tailwind init
- 编辑tailwind.config.js
module.exports = {
content: ["./public/**/*.{html,js}"],
}
- 新建postcss.config.js
module.exports = {
plugins: [
require("tailwindcss"),
require("autoprefixer")
]
}
- 新建css/tailwind.css
@tailwind base;
@tailwind components;
@tailwind utilities;
- 编辑package.json
{
"scripts": {
"build": "postcss css/tailwind.css -o public/build/tailwind.css"
},
}
- 命令
* npm run build
- 新建public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>tailwind</title>
<link rel="stylesheet" href="./build/tailwind.css"/>
</head>
<body>
<h1 class="text-4xl font-bold text-center text-blue-500">hello world</h1>
</body>
</html>
标签:基本,npm,tailwind,build,tailwindcss,使用,postcss,css
From: https://www.cnblogs.com/linding/p/17483165.html