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

extractAll query mismatch #25

Open
nicolasdelfino opened this issue Jan 27, 2020 · 1 comment
Open

extractAll query mismatch #25

nicolasdelfino opened this issue Jan 27, 2020 · 1 comment

Comments

@nicolasdelfino
Copy link

Specifying extractAll to false and using this query in postcss.config.js

queries: {
        "screen and (min-width: 1024px)": "desktop"
} 

against this css rule (base.css):

@media screen and (min-width: 1024px)

doesn't result in expected extraction of files base.css & base-desktop.css

Even though there is no visual indication of the strings not being equal we can confirm that they're not by comparing them:

if (opts.output.path) {
root.walkAtRules('media', atRule => {
    
const query = atRule.params;
const queryname = opts.queries[query] || (opts.extractAll && _.kebabCase(query));

const test = 'screen and (min-width: 1024px)';
console.log(query.localeCompare(test)); // = -1

Removing the space between min-width: and 1024px seems to do the trick:

queries: {
        "screen and (min-width:1024px)": "desktop"
} 
@philwolstenholme
Copy link

I had a similar issue and it was because cssnano was compressing my CSS earlier in the pipeline, if anyone else stumbles onto this issue then check you don't have a minifier/compressor stripping spaces,

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