premailer / css_parser

Ruby CSS Parser
Other
279 stars 110 forks source link

Prevent non-important declaration taking over prior important #93

Closed albertinator closed 3 years ago

albertinator commented 6 years ago

Prior !important declarations should not be overridden by subsequent same-property declarations that are not !important.

Hypothetical example:

a {
  color: #fff !important;
  // some other stuff
  color: #000;
}

From this, the parser should produce the relevant a RuleSet resolve to the following:

a {
  color: #fff !important;
  // some other stuff
}

Otherwise, for all other situations, the subsequent declaration should overwrite the first.

This isn't happening currently, but this PR addresses this issue and tests for it.

albertinator commented 6 years ago

@akzhan can you give this a review and merge if you're good with it? Thanks!