daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

bug: Nested @property causes PostCSS build warnings

Open brianhelba opened this issue 9 months ago β€’ 13 comments

Reproduction URL (Required)

https://github.com/brianhelba/parcel-tailwind-postcss/tree/daisy-build

What version of daisyUI are you using?

5.0.35

Which browsers are you seeing the problem on?

No response

Describe your issue

When built, daisyUI's @property --radialprogress is nested within a @layer base with the overall structure:

@layer base {
  @property --radialprogress {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 0%;
  }
}

However, Parcel (a popular tool for building with PostCSS) expects that:

@property is only valid at the top level, not inside a layer

This causes builds of Tailwind + daisyUI with Parcel to emit the warning:

@parcel/transformer-css: Unknown at rule: @property

Given than the effects of registering a @property are indeed global (it's meaningless to scope to a @layer), could the definition of @property --radialprogress be moved to the top level (just like all the other @property --tw-border-style, etc.)?

brianhelba avatar May 15 '25 19:05 brianhelba

Thank you @brianhelba for reporting issues. It helps daisyUI a lot πŸ’š
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

github-actions[bot] avatar May 15 '25 19:05 github-actions[bot]

@saadeghi Given that you haven't received a response to https://github.com/parcel-bundler/lightningcss/issues/968#issuecomment-2916639715 , would it be possible to move forward with just addressing this within Daisy?

I agree, it shouldn't matter whether a @property is defined within a @layer or not, but maybe @property --radialprogress could be moved to the top level, just to keep other tools happy?

brianhelba avatar Jul 01 '25 01:07 brianhelba

The current Tailwind CSS plugin API only allows adding styles to Tailwind layers. So it's not possible. A workaround would be excluding properties file:
https://daisyui.com/docs/base/

saadeghi avatar Jul 01 '25 01:07 saadeghi

I just uncomented: //export default {"@property --radialprogress":{"syntax":"""","inherits":"true","initial-value":"0%"}};

in: node_modules/daisyui/base/properties/object.js

the warining will disapear

almirhodzic avatar Oct 08 '25 15:10 almirhodzic

@almirhodzic Easier way in your CSS file:

@plugin "daisyui" {
  exclude: properties;
}

Which excludes this file

saadeghi avatar Oct 08 '25 17:10 saadeghi

@almirhodzic Easier way in your CSS file:

@plugin "daisyui" {
  exclude: properties;
}

Which excludes this file

perf! thanks!

almirhodzic avatar Oct 08 '25 17:10 almirhodzic

I'm getting the same error using tailwindcss cli tool (not parcel)

/*! 🌼 daisyUI 5.3.10 */
Found 1 warning while optimizing generated CSS:
 
β”‚ }
β”‚ @layer base {
β”‚   @property --radialprogress {
┆            ^-- Unknown at rule: @property

Using the @saadeghi workaround for now

dorsma avatar Oct 30 '25 20:10 dorsma

Thanks, folks, but can this file be excluded without any problems?

phcoliveira avatar Nov 06 '25 09:11 phcoliveira

Yes, if you don't use radial progress If you do use it, exclude properties and copy-paste the definition of the property in your css at the top

pdanpdan avatar Nov 06 '25 09:11 pdanpdan

I’m a bit late to the party, so is there no way to fix this warning in DaisyUI itself?

I’m using the .radial-progress component, but I still see this warning.

transforming (1) resources/js/app.js/*! 🌼 daisyUI 5.5.5 */

Found 1 warning while optimizing generated CSS:
 
β”‚ }
β”‚ @layer base {
β”‚   @property --radialprogress {
┆            ^-- Unknown at rule: @property

robsontenorio avatar Nov 19 '25 19:11 robsontenorio

Exclude the properties and add it by hand in your css. That way you have the property defined and no warning.

pdanpdan avatar Nov 19 '25 19:11 pdanpdan

Thanks! πŸ™‚

However, I prefer to stick to the default settings and avoid any additional elements in my app.css file. I will wait for a definitive fix.

robsontenorio avatar Nov 19 '25 19:11 robsontenorio

This is just a warning and will not affect your final build. This king of warning occurs not only in PostCSS but also in tools like Lightning CSS (used by Vite). Those tools emit this kind of warning because they don't understand @property or expect it to be declarad in a specific way. You can just ignore the warning because it do not interfer the CSS parse, minification and bundle provided by tools like PostCSS or Lightning CSS. The final bundled build will be interpreted and rendered by the browser, which can handle @property without problem.

mtarroyo avatar Nov 24 '25 02:11 mtarroyo