rennat / pynliner

Python CSS-to-inline-styles conversion tool for HTML using BeautifulSoup and cssutils
http://pythonhosted.org/pynliner/
181 stars 93 forks source link

Update __init__.py #48

Closed ianjvr-genesys closed 8 years ago

ianjvr-genesys commented 8 years ago

To my understanding inline styles take preference so lets simulate the behavior.

Instead of just adding the styles to the start of the styles tag, parse the existing styles and only add the items thats not already present.

rennat commented 8 years ago

I appreciate the pull request. While it would be nice to have the smaller size by de-duping rules, there are enough cases where you'll use multiple values for the same rule to allow fallback values for rendering engines that don't support certain features that I'm going to nix this :(

example where it is desired to have multiple of the same rule:

.myfancybackground {
  /* this should work everywhere */
  background: blue;
  /* IE <10 won't see this as a valid rule so it will keep using the last value */
  background: linear-gradient( 45deg, blue, red );
}