postcss-critical-css icon indicating copy to clipboard operation
postcss-critical-css copied to clipboard

Emits "You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing..." warning if scss entrypoint are passed to Webpack config

Open bitfella opened this issue 5 years ago • 2 comments

Hello, postcss-crititical-css emits the following annoying console warning several times:

40% building 5/7 modules 2 active ...s\sass-loader\dist\cjs.js!C:\Migu\postcss-critical-css-test-master\src\module.scssYou did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.
40% building 7/8 modules 1 active ...s\sass-loader\dist\cjs.js!C:\Migu\postcss-critical-css-test-master\src\module.scssYou did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.

when scss (and css as well) entrypoints are passed to Webpack configuration object. This happens when js entrypoints import css/scss files in which @critical rules are called.

Example:

module.exports = () => {
    return {
        entry: {
            main: path.join(__dirname, 'src', 'main.js'),
            site: path.join(__dirname, 'src', 'site.scss')
        },
        ...
    }
}

In this case, main.js imports main.scss that carries a @critical rule, while site.scss may or may not carry @critical rules (both ways will emit warnings).

Unfortunately I can't transform scss entrypoints into js ones and there's no way of silence warnings even playing with Webpack's stats options.

Thanks

bitfella avatar Nov 04 '19 17:11 bitfella

Thanks for the report, I'll take a look.

zgreen avatar Dec 30 '19 21:12 zgreen

I am encountering the same problem when running postcss-critical-css from within a CodeKit hook using postcss-cli.

I am importing scss files which are then compiled to a single css file using CodeKit’s libsass compiler. Said css file then serves as the entrypoint for my PostCSS plugin chain. However, any imported scss file carrying a @critical rule will result in the console warning mentioned by the OP. It’s worth noting that despite the warning everything compiles correctly.

timjuedemann avatar Jan 09 '20 20:01 timjuedemann