postcss-advanced-variables
postcss-advanced-variables copied to clipboard
Spurious(?) error message after upgrading to 3.0
With 2.3.2 my (large, complicated) Gatsby / Webpack project works fine. If I upgrade to 3.0 I get (many) reports of
You did not set any plugins, parser, or stringifier. Right now, PostCSS does not
hing. Pick plugins for your case on https://www.postcss.parts/ and use them in p
ostcss.config.js.
Postcss still runs, still produces correct output. Any ideas?
It's a very large project but am trying to reduce to a reproducible example.
I think I'm seeing this when @importing a css file from inside node_modules.
Have got a minimal case now.
This file compiles without error
@import 'included.css';
This file generates the error
.some-class {
@import 'included.css';
}
I don’t think I have ever supported @import within a rule. How might this be related to the recent major release?
😢
my minimal case works in 2.3.2 - just my luck if this was accidental all along! :-)
btw an example of why this behaviour is really useful: namespaced themes, by doing
a.css
$colour=#0f0;
.theme-a {
@import 'everything.css';
}
b.css
$colour=#f00;
.theme-b {
@import 'everything.css';
}
the unexpected thing is that despite the error message, the right css is generated. ¯_(ツ)_/¯
i'm also experiencing this warning, seemingly for no reason. my minimum test case is as follows:
Invoked postcss using postcss-cli (v6.1.0). This includes postcss version 7.0.7.
$ postcss styles/test.css -o output.css
Using the following postcss.config.js in the cwd:
module.exports = {
plugins: [
require('postcss-advanced-variables')(),
],
};
On the following file (styles/test.css):
@import './test_include.css'
With the following file sitting beside it (styles/test_include.css):
p {
padding: 16px;
}
In fact, even if i make styles/test_include.css completely blank, I still get the warning.
Just another data point:
I tried added a custom parser to my config, hoping to suppress the warning since it seems like it is asking for at least one of those config properties. I added postcss-scss as my parser, and I still got the warning.
I also tried renaming my files to end in the .scss extension, because I didn't know if that would matter. Still got the warning.
I did a little more digging, and found that the Processor#process method is being called twice. The first time the self.plugins array contains one value, null. The second time self.plugins is an empty array. The warning is generated that second time.
My theory is that when this plugin encounters an @import, it asks postcss to process the target file, but doesn't pass along the config properly. That might be why the second time the method is run it finds an empty plugins array.
PS. I'm curious why the first time the method is called it has a single null in that array, but I don't know anything about postcss internals. It just seems odd.