Tailwindscss가 HTML에서 사용하는 방법을 영어로 기술해 봤습니다.
7778 단어 CSSTailwind CSShtnltech
이유는 제가 영어를 잘 못하지만 요즘은 현대 기술을 추구할수록 영어로 정보를 수집하는 신선도와 정확도가 높다는 생각에 의식적으로 영어를 쓰려고 한다는 것입니다.
그럼 바로 시작합시다.📛
Why Tailwindcss
Differences from bootstrap
How to set up Tailwindcss
installing Tailwind CSS as a PostCSS plugin
cd desktop
mkdir your-directory-name
cd your-directory
npm -init y
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
npx tailwindcss init -p
/* ./your-css-folder/styles.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
! If css validation is working, install the PostCSS Language Support extension to vscode
index.HTML
files <link rel="stylesheet" href="dist.css" />
dist.css
file "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "build": "postcss styles.css -o dist.css"
},
npm uninstall postcss
npm i -D postcss-cli
npm run build
available Use Purge and Minify to build in production environment
What is
autoprefixer
?Example:
purge
css that is not used in index.htmlmodule.exports = {
+ purge: ["./index.html"],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
"scripts": {
- "build": "postcss styles.css -o dist.css"
+ "build": "NODE_ENV=production postcss styles.css -o dist.css"
},
npm i -D cssnano
minify
to make it even lighter. cssnano: {},
to postcss.config.js
. module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
+ cssnano: {},
},
}
"dev..."
to package.json
. "scripts": {
+ "dev": " postcss styles.css -o dist.css",
"build": "NODE_ENV=production postcss styles.css -o dist.css"
},
postcss.config.js
.module.exports = (ctx) => {
return {
plugins: {
tailwindcss: {},
autoprefixer: {},
cssnano: ctx.env === "production" ? {} : false,
},
};
};
Reference
이 문제에 관하여(Tailwindscss가 HTML에서 사용하는 방법을 영어로 기술해 봤습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/ken505/articles/64617d7149794c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)