GoogleChromeLabs / postcss-jit-props

A CSS custom property helper based on PostCSS. Supply a pool of variables and this plugin will add them to the stylesheet as they are used.
https://stackblitz.com/edit/jit-open-props?file=postcss.config.js
Apache License 2.0
210 stars 9 forks source link

Breaks when the source file only contains @at rules. #40

Open flmng0 opened 11 months ago

flmng0 commented 11 months ago

Hello!

When processing a source file which only contains at-rules, the plugin breaks.

From my error code and brief skim, it seems to occur from Line 123 of index.js.

The error reported reads as: Cannot read properties of undefined (reading 'source').

The problem file in question is a file from open-props: open-props/media.css.

I will do a workaround and create a pull request once I get home.

Thanks

argyleink commented 2 months ago

this still happening? i'd love a stackblitz or recreatable env for me to test, poke and prod for how to guard or fix the issue 👍🏻