Closed fabis94 closed 1 year ago
Well, on my end:
tailwind.css
output with the correct result, and then when the content of tailwind.css
is about to insert into the DOM something unexpected happens which results in the incorrect behavior. The compiled style rule of the new class isn't added in the <style>
tag.<style>
tag is "1 commit behind" the tailwindcss output.I am experiencing this too. Did anyone find a quick work around?
I am having the same issue. I am using nutx3
with pnpm
if that matters.
same issue. :((
A workaround for local development is to just whitelist every single tailwind class. This adds ~27,000 lines of CSS directly in your head so it's a terrible idea, but it unblocks development - can just disable this config when building for deployments.
in tailwind.config.js
:
module.exports = {
...
// Due to issue of class-detection not auto-refreshing
// Disable this to build for production
safelist: [
{
pattern: /.*/,
},
],
...
}
By the way, I was able to get that issue consistently reproducing under the playground of this module.
The issue starts to reproduce when you add some extra CSS to css
tag, e.g.:
export default defineNuxtConfig({
buildModules: [
tailwindModule
],
tailwindcss: {
exposeConfig: true
},
css: [
'@fontsource/inter/400.css',
'@fontsource/inter/500.css',
'@fontsource/inter/600.css',
'@fontsource/inter/700.css'
]
})
Also, it requires router to be present, so app.vue
won't work, while pages/index.vue
will.
@fabis94:
(I don't know why a saved change to tailwind.css causes tailwind to see the new class usage, but a saved change to the vue file that actually uses the class doesn't. The vue file is definitely correctly specified under 'content' in the tailwind config, otherwise it wouldn't even work after restarting the dev server)
Because there is no way for the build system to know dependencies between Vue and CSS, and that HMR should replace the CSS file when your Vue file changes. From bundler point of view these two are completely unrelated, but really CSS content is dependent on markup.
I wonder why HMR even worked in the first place. From my understanding, it shouldn't.
I resolved this issue by adding ./error.vue
to my tailwind.config.js
. It seemed like Tailwind needed to look at the contents of this file to be able to include the relevant classes.
module.exports = {
content: [
"./components/**/*.{js,vue,ts}",
"./layouts/**/*.vue",
"./pages/**/*.vue",
"./plugins/**/*.{js,ts}",
"./nuxt.config.{js,ts}",
"./error.vue",
],
same problem with
"@nuxtjs/tailwindcss": "^6.6.5",
"nuxt": "^3.3.3",
when using default Tailwind CSS file from runtime/tailwind.css instead of creating your own
Closing this issue as it is believed to be resolved/stale now - please feel free to comment if it is still an issue in the latest version of the module.
This issue is still occuring
"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxtjs/tailwindcss": "^6.8.0",
"@types/node": "^18.17.1",
"nuxt": "^3.6.5"
}
This issue is still occuring
"devDependencies": { "@nuxt/devtools": "latest", "@nuxtjs/tailwindcss": "^6.8.0", "@types/node": "^18.17.1", "nuxt": "^3.6.5" }
Did you solve it?
bug still exist
"@nuxtjs/tailwindcss": "^6.11.4",
"tailwindcss": "^3.4.3"
Still happening.
Darwin
v21.7.3
3.11.2
3.11.1
2.9.6
bun@1.1.5
-
devtools
, css
, postcss
-
-
This also happens when I install tailwind manually (without this module). 🤔
same issue . enable disable cache in your browser then refresh that
Definitely sounds like a cache issue to me!
youre welcome buddy
Version
@nuxtjs/tailwindcss: 5.0.3 nuxt: 3.0.0-rc.1 (with vite builder) tailwindcss: 3.0.24
Steps to reproduce
What is Expected?
The class should be added to the page's CSS immediately after it's used for the first time in the project (e.g. in a Vue component).
What is actually happening?
Class doesn't appear, even after refreshing. Only after nuxt is restarted does the new class get added to the page. OR if the tailwind.css file is saved.
(I don't know why a saved change to tailwind.css causes tailwind to see the new class usage, but a saved change to the vue file that actually uses the class doesn't. The vue file is definitely correctly specified under 'content' in the tailwind config, otherwise it wouldn't even work after restarting the dev server)