postcss / postcss-simple-vars

PostCSS plugin for Sass-like variables
MIT License
415 stars 36 forks source link

[object Object] is not a PostCSS plugin error when used with Laravel Mix #123

Closed tyssen closed 12 months ago

tyssen commented 12 months ago

With this simple test case:

const mix = require('laravel-mix');
const theme = process.env.PREVIEW ? 'theme-preview' : 'theme';

mix.setPublicPath('dist');

mix.options({
    extractVueStyles: true,
    processCssUrls: false
});

mix.postCss('app/styles/test.css', 'dist', [
    require('postcss-simple-vars')({ variables: theme })
]);

I get:

Error: [object Object] is not a PostCSS plugin

Not sure if I'm doing something wrong or if this is a bug?

ai commented 12 months ago

This error is coming from laravel-mix. Very likely that you are using PostCSS API in a wrong way. But it is better to ask Laravel community.