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

media query extra space #324

Open
tomhodgins opened this issue Dec 16, 2016 · 4 comments · May be fixed by #640
Open

media query extra space #324

tomhodgins opened this issue Dec 16, 2016 · 4 comments · May be fixed by #640

Comments

@tomhodgins
Copy link

@media (min-width: 1px) {
  :root {
    background: lime;
  }
}

correct minification

@media(min-width:1px){:root{background:lime}}
  • whitespace not required after @media unless followd by a word like screen, etc.

CSSnano output

@media (min-width:1px){:root{background:lime}}
  • left optional whitespace after @media
@ben-eb
Copy link
Collaborator

ben-eb commented Dec 16, 2016

I'm not sure that we used to do this or not, but this behaviour is consistent with both https://github.com/jakubpawlowicz/clean-css & https://github.com/css/csso, which is to say I believe it is correct. I need tests in all browsers to prove or disprove that theory before I change any behaviour.

@yisibl
Copy link

yisibl commented Aug 3, 2022

@alexander-akait Did you know that Is it safe to remove the spaces after @media in all browsers? How is this handled in SWC?

@alexander-akait
Copy link
Member

@yisibl By spec it is safe, in swc we are removing space

@yisibl
Copy link

yisibl commented Aug 10, 2022

@yisibl By spec it is safe, in swc we are removing space

Nice work

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

Successfully merging a pull request may close this issue.

6 participants