Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin does not work with media queries #7

Open
tyteen4a03 opened this issue Apr 18, 2020 · 1 comment
Open

Plugin does not work with media queries #7

tyteen4a03 opened this issue Apr 18, 2020 · 1 comment

Comments

@tyteen4a03
Copy link

I have this media query:

            @media not all and (hover: none) {
                scrollbar-width: none;
            }

It returns TypeError: Cannot read property 'selector' of undefined.

/* eslint global-require: 0, import/no-extraneous-dependencies: 0 */

const production = !process.env.ROLLUP_WATCH;

module.exports = {
    plugins: [
        require('postcss-import'),
        require('postcss-preset-env'),
        require('tailwindcss'),
        require('postcss-mixins'),
        require('postcss-simple-vars'),
        require('postcss-color-mod-function'),
        require('postcss-scrollbar'),
        require('autoprefixer'),
        require('postcss-nested'),
        ...(production ? [require('@fullhuman/postcss-purgecss')({
            content: ['./**/*.html', './**/*.svelte'],
            whitelistPatterns: [/svelte-/, /tippy/],
            defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
        })] : []),
        ...(production
            ? [require('cssnano')({
                preset: 'default',
            })] : []
        ),
    ],
};
@pascalduez
Copy link
Owner

Hi,

this is because you use nesting, and your postcss-nested plugin is one of the last one in the chain.
A quick fix would be to move it up.
Nonetheless, I'll land a patch to prevent this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants