Filters not working on production build #7131
-
Hi, I am using tailwind 3.0.15 with Nuxt.js. I have a problem using the following filters with a background image: <section
class="relative flex items-center justify-center min-h-screen before:content-[''] before:bg-hero-image before:absolute before:top-0 before:left-0 before:w-full before:h-full before:bg-cover before:filter before:grayscale before:brightness-50"
> On dev build it works but not on production build. You can see the full code here: https://github.com/huco95/don-jamon-web/blob/master/components/Hero.vue Thanks!🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 6 replies
-
Seeing similar issues, posted my findings here: #7044 Seems to be 3.0.12 and above broke this. Try downgrading to 3.0.11 and report if it fixes for you? |
Beta Was this translation helpful? Give feedback.
-
I think this only happens when you apply more than one filter. I don't know if that helps to solve the issue 🐕🦺 |
Beta Was this translation helpful? Give feedback.
-
This still seems to be broken in v3.1.8 |
Beta Was this translation helpful? Give feedback.
-
v3.2.1 still broken |
Beta Was this translation helpful? Give feedback.
-
v3.2.2 still broken |
Beta Was this translation helpful? Give feedback.
-
v3.2.4 still broken. |
Beta Was this translation helpful? Give feedback.
-
The issue is in your minifier, you must be using some old version of cssnano or similar that is improperly minifying the CSS. Here's the difference between v3.0.11 and v3.0.12: /* v3.0.11 */
* {
--tw-blur: var(--tw-empty,/*!*/ /*!*/);
--tw-brightness: var(--tw-empty,/*!*/ /*!*/);
--tw-contrast: var(--tw-empty,/*!*/ /*!*/);
--tw-grayscale: var(--tw-empty,/*!*/ /*!*/);
--tw-hue-rotate: var(--tw-empty,/*!*/ /*!*/);
--tw-invert: var(--tw-empty,/*!*/ /*!*/);
--tw-saturate: var(--tw-empty,/*!*/ /*!*/);
--tw-sepia: var(--tw-empty,/*!*/ /*!*/);
--tw-drop-shadow: var(--tw-empty,/*!*/ /*!*/);
}
/* v3.0.12 */
* {
--tw-blur: ;
--tw-brightness: ;
--tw-contrast: ;
--tw-grayscale: ;
--tw-hue-rotate: ;
--tw-invert: ;
--tw-saturate: ;
--tw-sepia: ;
--tw-drop-shadow: ;
} What we were doing in v3.0.11 was a lame hack/trick to prevent the minifier from removing the space before the semicolon. That bug was fixed in all minifiers, so we removed the So make sure you are on the latest version of whatever CSS minification tool you are using and everything will work. If not it is a bug in your minifier that is removing important whitespace. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue but in the Development build |
Beta Was this translation helpful? Give feedback.
-
v3.2.7 still broken for me |
Beta Was this translation helpful? Give feedback.
-
I don't see this ever getting fixed.... |
Beta Was this translation helpful? Give feedback.
-
So, I was also getting this kind of issue, that's what I noticed: When using the filter class into my code the CSS class were being applied to the page, but without use the class and trying to add it to some element using |
Beta Was this translation helpful? Give feedback.
The issue is in your minifier, you must be using some old version of cssnano or similar that is improperly minifying the CSS.
Here's the difference between v3.0.11 and v3.0.12: