Created
February 9, 2023 18:13
-
-
Save eiiot/4072eef530f9092a121fd6b3e097519b to your computer and use it in GitHub Desktop.
Quickly initiate TailwindCSS in a Next.js project (no `/app` directory support)
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
#!/bin/bash | |
yarn add -D tailwindcss postcss autoprefixer | |
npx tailwindcss init -p | |
# replace tailwind.config.js with the following | |
STRING="/** @type {import('tailwindcss').Config} */ | |
module.exports = { | |
content: [ | |
\"./pages/**/*.{js,ts,jsx,tsx}\", | |
\"./components/**/*.{js,ts,jsx,tsx}\", | |
], | |
theme: { | |
extend: {}, | |
}, | |
plugins: [], | |
}" | |
echo "$STRING" > tailwind.config.js | |
echo "Updated tailwind.config.js" | |
# update global css file | |
echo "@tailwind base; | |
@tailwind components; | |
@tailwind utilities;" | cat - styles/globals.css > temp && mv temp styles/globals.css | |
echo "Updated styles/globals.css" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use at your own risk :)