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

Incorrect order with structural optimisation of media queries #358

Closed
FQZhang opened this issue Oct 19, 2017 · 6 comments
Closed

Incorrect order with structural optimisation of media queries #358

FQZhang opened this issue Oct 19, 2017 · 6 comments

Comments

@FQZhang
Copy link

FQZhang commented Oct 19, 2017

Example Source:

h1 {
  color: blue;
  font-family: 'Open Sans';
  font-weight: 600;
  font-style: normal;
  line-height: 1.5;
  text-transform: uppercase;
  font-size: 25px;
}
@media screen and (min-width: 641px) {
  h1 {
    font-size: 40px;
  }
}

h2 {
  color: black;
  font-family: 'Open Sans';
  font-weight: 600;
  font-style: normal;
  line-height: 1.5;
  text-transform: uppercase;
  font-size: 22px;
}
@media screen and (min-width: 641px) {
  h2 {
    font-size: 35px;
  }
}

h3 {
  color: blue;
  font-family: 'Open Sans';
  font-weight: normal;
  font-style: normal;
  line-height: 1.5;
  font-size: 20px;
}
@media screen and (min-width: 641px) {
  h3 {
    font-size: 30px;
  }
}

h4 {
  color: blue;
  font-family: 'Open Sans';
  font-weight: normal;
  font-style: normal;
  line-height: 1.5;
  font-size: 22px;
}
@media screen and (min-width: 641px) {
  h4 {
    font-size: 25px;
  }
}

h5 {
  color: blue;
  font-family: 'Open Sans';
  font-weight: normal;
  font-style: normal;
  line-height: 1.5;
  font-size: 22px;
}
@media screen and (min-width: 641px) {
  h5 {
    font-size: 20px;
  }
}

h6 {
  color: blue;
  font-family: 'Open Sans';
  font-weight: normal;
  font-style: normal;
  line-height: 1.5;
  font-size: 16px;
}
@media screen and (min-width: 641px) {
  h6 {
    font-size: 18px;
  }
}

however the output has a font-size for h2 that is after the h2 media query based font size:

h1,h2 {
    text-transform: uppercase;
    font-weight: 600
}

h1 {
    font-size: 25px;
    color: #00f
}

@media screen and (min-width:641px) {
    h1 {
        font-size: 40px
    }
}

h1,h2,h3,h4,h5,h6 {
    font-family: 'Open Sans';
    font-style: normal;
    line-height: 1.5
}

h2 {
    color: #000
}

@media screen and (min-width:641px) {
    h2 {
        font-size: 35px
    }
}

h3,h4,h5,h6 {
    color: #00f;
    font-weight: 400;
    font-size: 20px
}

@media screen and (min-width:641px) {
    h3 {
        font-size: 30px
    }
}

h2,h4,h5,h6 {
    font-size: 22px
}

@media screen and (min-width:641px) {
    h4 {
        font-size: 25px
    }
}

@media screen and (min-width:641px) {
    h5 {
        font-size: 20px
    }
}

h6 {
    font-size: 16px
}

@media screen and (min-width:641px) {
    h6 {
        font-size: 18px
    }
}
@armellarcier
Copy link

Any info ? Status ? I'm getting the same kind of problems.

@klickreflex
Copy link

Just bumped into the exact same issue. Can't believe there are not many more people having this problem.

@klickreflex
Copy link

For now I solved this by passing the option restructure: false.

Related: for me this bug has prevented PurgeCSS from working properly. Without restructuring being disabled PurgeCSS is working again, too.

@jenstornell
Copy link

I agree. restructure: false does the trick, but better to have the issue fixed in the long run.

@McGern
Copy link

McGern commented Jun 5, 2019

Have the same issue with the restructure option, thought I was going mad. Used the online tool https://css.github.io/csso/csso.html
with this css

blockquote {
font-family: Arial, sans-serif;
font-weight: normal;
margin-bottom: 30px;
}

dt {
font-family: Arial, sans-serif;
font-weight: 600;
margin: 10px 10px 0 10px;
}

dd {
font-family: Arial, sans-serif;
font-weight: normal;
margin: 0 15px 20px 10px;
}

and get this

blockquote,dd{font-weight:400}blockquote,dd,dt{font-family:Arial,sans-serif}blockquote{margin-bottom:30px}dd,dt{font-weight:600;margin:10px 10px 0}dd{margin:0 15px 20px 10px}

@lahmatiy
Copy link
Member

Fix published in 4.0.3

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

No branches or pull requests

6 participants