Skip to content

Instantly share code, notes, and snippets.

@gocs
Last active August 20, 2023 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gocs/47064c52fdc8529499f88c43a653aba2 to your computer and use it in GitHub Desktop.
Save gocs/47064c52fdc8529499f88c43a653aba2 to your computer and use it in GitHub Desktop.
angular tailwind template (angular 15)

Angular Tailwind Template

this should work for angular version 12 above

this template will automate the creation process of angular and tailwind as manually instructed here: https://tailwindcss.com/docs/guides/angular

create angular app

npx -p @angular/cli ng new $(basename "$PWD") --directory=./ --skip-git --style=scss --defaults

install tailwind

npm install -D tailwindcss postcss autoprefixer \
  && npx tailwindcss init

configure tailwind for angular

sed -i 's/content: \[\]/content: \[\".\/src\/**\/*.{html,ts}"]/g' tailwind.config.js \
  && printf "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n" | tee -a src/styles.scss
npx -p @angular/cli ng new $(basename "$PWD") --directory=./ --skip-git --style=scss --defaults \
&& npm install -D tailwindcss postcss autoprefixer \
&& npx tailwindcss init \
&& sed -i 's/content: \[\]/content: \[\".\/src\/**\/*.{html,ts}"]/g' tailwind.config.js \
&& printf "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n" | tee -a src/styles.scss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment