Installation
在 Angular 專案中設定 Tailwind CSS。
如果你還沒有設定專案,請先建立一個新的 Angular 專案。最常見的方式是使用 Angular CLI。
ng new my-project --style csscd my-project透過 npm 安裝 @tailwindcss/postcss 及其對等相依套件。
npm install tailwindcss @tailwindcss/postcss postcss --force在專案根目錄建立 .postcssrc.json 檔案,並將 @tailwindcss/postcss 外掛加入你的 PostCSS 設定。
{ "plugins": { "@tailwindcss/postcss": {} }}在 ./src/styles.css 中加入 @import 來匯入 Tailwind CSS。
@import "tailwindcss";使用 ng serve 執行建置流程。
ng serve開始使用 Tailwind 的通用類別來設定內容樣式。
<h1 class="text-3xl font-bold underline"> Hello world!</h1>