Gatsby V3 and tailwindcss #29944
Replies: 2 comments 8 replies
-
I also just updated a project to Gatsby v3 that has a Tailwind setup. I normally don't use the PostCSS setup, I just have it present in case I need something that is not supported with twin.macro. But I just activated it and tested it with one Tailwind and PostCSS deps
postcss.config.jsmodule.exports = {
plugins: [
require("tailwindcss")("./tailwind.config.js"),
require("postcss-flexbugs-fixes"),
require("postcss-import"),
require("postcss-preset-env")({
autoprefixer: {
flexbox: "no-2009"
},
stage: 3,
features: {
"custom-properties": false
},
browsers: ["> 1%", "last 2 versions", "Firefox ESR"]
})
]
} globals.css@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.btn-blue {
@apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75;
}
} The generated output on my side doesn't contain any directives. Maybe it works if you upgrade some dependencies (if this is possible for you - or just to see if this would fix it)? However, this is a very minimal setup I don't actually use, but I can observe, that generated CSS for it looks all right with Gatsby v3. |
Beta Was this translation helpful? Give feedback.
-
Thanks for creating the issue, any chance you can cook up a quick reproduction for us? Or share your site? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
Upgrading to gatsby V3 appears to go relatively smoothly. One problem I am facing is that tailwind does not appear to be working 100% anymore: the CSS generated in the header includes raw tailwind
@apply
directives.Any idea of why these directives would not be processed anymore? of the changes required to get it working?
postcss.config.js:
gatsby-browser.js:
and
./src/styles/base.css
includes@tailwind
directives as well as custom js imports.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions