Created
February 9, 2020 19:36
-
-
Save TomIrimescu/50544e6c8e0e416b3186126d8cf140a5 to your computer and use it in GitHub Desktop.
Steps to set up Tailwind in an Angular Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i tailwindcss postcss-scss postcss-import postcss-loader @angular-builders/custom-webpack -D | |
// styles.scss | |
@import 'tailwindcss/base'; | |
@import 'tailwindcss/components'; | |
@import 'tailwindcss/utilities'; | |
npx tailwind init | |
// tailwind.config.js | |
module.exports = { | |
theme: { | |
extend: {}, | |
}, | |
variants: {}, | |
plugins: [], | |
} | |
// webpack.config.js | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
test: /\.scss$/, | |
loader: 'postcss-loader', | |
options: { | |
ident: 'postcss', | |
syntax: 'postcss-scss', | |
plugins: () => [ | |
require('postcss-import'), | |
require('tailwindcss'), | |
require('autoprefixer'), | |
] | |
} | |
} | |
] | |
} | |
}; | |
// angular.json | |
{ | |
"architect": { | |
"build": { | |
"builder": "@angular-builders/custom-webpack:browser", | |
"options": { | |
"customWebpackConfig": { | |
"path": "./webpack.config.js" | |
} | |
} | |
}, | |
"serve": { | |
"builder": "@angular-builders/custom-webpack:dev-server", | |
"options": { | |
"customWebpackConfig": { | |
"path": "./webpack.config.js" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment