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

Bug: "does not pass the 'from' option to 'postcss.parse'" #21

Closed hugo-t-b closed 1 year ago

hugo-t-b commented 1 year ago

Vite 3 shows the following warning when this plugin is enabled:

A PostCSS plugin did not pass the `from` option to `postcss.parse`. This may cause imported assets to be incorrectly transformed. If you've recently added a PostCSS plugin that raised this warning, please contact the package author to fix the issue.

The docs for postcss.parse are here.

argyleink commented 1 year ago

strange, this plugin doesn't call postcss.parse(), so there's no parameter to pass to make the warning go away

kelvindecosta commented 1 year ago

Hey @argyleink

I think this might be the offending line:

https://github.com/GoogleChromeLabs/postcss-jit-props/blob/82b9f12d056f53844eb798a2b1e20ab10baae850/index.js#L62

PS: Happy New Year!

argyleink commented 1 year ago

fixed in v1.0.9 👍🏻

fkrauthan commented 1 year ago

For some reason I get this error with version 1.0.9 too: My postcss config looks like this:

const postcssJitProps = require('postcss-jit-props');
const postcssCustomMedia = require('postcss-custom-media');
const postcssGlobalData = require('@csstools/postcss-global-data');
const autoprefixer = require('autoprefixer');
const OpenProps = require('open-props');

module.exports = {
  plugins: [
    postcssJitProps(OpenProps),
    postcssGlobalData({
      files: [
        require.resolve('open-props/media.min.css'),
      ],
    }),
    postcssCustomMedia(),
    autoprefixer,
  ]
}