Skip to content

Instantly share code, notes, and snippets.

@eiiot
Created February 9, 2023 18:13
Show Gist options
  • Save eiiot/4072eef530f9092a121fd6b3e097519b to your computer and use it in GitHub Desktop.
Save eiiot/4072eef530f9092a121fd6b3e097519b to your computer and use it in GitHub Desktop.
Quickly initiate TailwindCSS in a Next.js project (no `/app` directory support)
#!/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"
@eiiot
Copy link
Author

eiiot commented Feb 9, 2023

Use at your own risk :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment