maximkoretskiy / postcss-initial

PostCSS plugin to fallback initial keyword
MIT License
187 stars 11 forks source link

Shorthands with unsupported attributes don’t apply #12

Closed kinday closed 8 years ago

kinday commented 8 years ago

Easy way: don’t include attributes that are not supported widely into shorthands. Hard way: build fallback according to specified list of browsers using caniuse as autoprefixer do.

Example of Chrome completely ignoring font shorthand: image

maximkoretskiy commented 8 years ago

We can add more than one rule to handle this situation

Example

a {
  font: normal normal normal normal 100% normal normal; /* Browser applies this rule*/
  font: normal normal normal normal medium/normal normal normal;  /* Browser can`t parse this rule, so it uses previous */
}

@kinday What do You this about this solution?

kinday commented 8 years ago

I like how this solution takes best from my proposals yet remains simple.

maximkoretskiy commented 8 years ago

@kinday After some research, I decided not to use a shortcut for font declaration. For 'text-decoration' we can use more short definition. U can see changes in the new release.

https://github.com/maximkoretskiy/postcss-initial/commit/dd33199f60fc6f40568de159617e1949125fdbf9?diff=split

kinday commented 8 years ago

@maximkoretskiy, great job! I personally don’t use shorthands most of the time. The rule is not to use shorthand unless you set all the properties it covers.

Thank you. I think issue may be closed.

maximkoretskiy commented 8 years ago

Thank you for feedback!