I've never had issues with Tailwind and Next, but today I'm learning Sanity and met a new error to add to my collection.
Typically when adding Tailwind to Next, all you need to do is...
npm i -D tailwindcss autoprefixer postcss
npx tailwindcss init -p
Add your tailwind imports to
styles/globals.css
:
@tailwind base;
@tailwind components;
@tailwind utilities;
Edit your
tailwind.config.js
file
/* tailwind.config.js */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Only to see this on my homepage when running sanity start
After a little searching I came across this reply in the Tailwind Github.
/* tailwind.config.js */
const path = require("path");
module.exports = {
content: [
path.join(__dirname, "./pages/**/*.{js,ts,jsx,tsx}"),
path.join(__dirname, "./components/**/*.{js,ts,jsx,tsx}"),
],
theme: {
extend: {},
},
plugins: [],
};
/* postcss.config.js */
const path = require("path");
module.exports = {
plugins: {
tailwindcss: {
config: path.join(__dirname, "tailwind.config.js"),
},
autoprefixer: {},
},
};
https://github.com/tailwindlabs/tailwindcss/issues/6393#issuecomment-1080723375
Shoutouts to wanjas
Top comments (0)