Skip to content

fix: support CSS modules with :root pseudo-class only #27

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

Merged
merged 1 commit into from
Aug 2, 2020

Conversation

jsikorski
Copy link
Contributor

Closes #26

@jcorkhill
Copy link

jcorkhill commented Jun 24, 2020

I still have this issue. As per #26, any SCSS file that contains a :root selector with no default classes fails to build with an Unterminated string literal error:

image

This is the stylesheet:

:root {
    box-sizing: border-box;
    font-size: calc(1vw + 0.6em);
}

@media (min-width: 50em) {
    :root {
        font-size: 1em;
    }
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    height: 100%;
    width: 100%;
}

img { 
    max-width: 100%; 
}

If I append a .whatever to the end of the file and populate it with any arbitrary property (like border: none), it works and Webpack compiles successfully.

@jsikorski
Copy link
Contributor Author

@JamieCorkhill
Do you still have the issue with the version I have proposed? I have just tried to compile the stylesheet you had provided and it seems to work.

Without changes from this PR error occurs but after applying this fix it seems to compile.

Maybe I have missed something and yout can provide some more information how to reproduce an issue?

@jcorkhill
Copy link

jcorkhill commented Jun 24, 2020

@jsikorski Sorry about that - I stupidly thought this had been merged. I saw the CI pass checks and I, for some reason, thought it had been merged. By applying the changes proposed in this PR the issue is indeed rectified. You can disregard my comment above.

@tswaters
Copy link

I hit this same issue, interesting workaround I found -- before (fails):

:root {
  --myvar: '#f00';
}

after (works)

/**/
:root {
  --myvar: '#f00';
}

Not sure why, but a blank block comment makes it work. Go figure.

Copy link
Contributor

@Obi-Dann Obi-Dann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Thanks for the PR, going to merge and release it shortly

@Obi-Dann Obi-Dann merged commit a16d625 into TeamSupercell:master Aug 2, 2020
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

Successfully merging this pull request may close these issues.

Build error for CSS modules with :root only
5 participants