Is there a .Net CSS parser that will allow me to parse css shorthand properties in the form of their long form?
For example, I would like to do the following:
#somediv{ margin: 10px; padding: 10px 20px; border:5px solid #FFF; }
And translate it into:
#somediv{ margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 20px; padding-bottom: 10px; padding-left: 20px; border-width: 5px; border-style: solid; border-color: #FFF; }
Here is a pretty good list of all the different properties that I will need to handle this way: http://www.dustindiaz.com/css-shorthand/
Ideally, I would like something in .Net, but if there is something in another open source language, I can probably adapt it.
Update
Without going into details about exactly what I'm trying to do here, is a basic premise:
I need to programmatically take multiple CSS documents and combine them to create one final CSS set.
So, if doc 1 has:
p { padding: 10px;}
And then add to doc 2:
p { padding-left:20px;}
The resulting CSS should be:
p { padding-top: 10px; padding-right:10px; padding-bottom:10px; padding-left:20px;}
Since a later added document overwrites one property. To do this for sure, I would need to take each CSS and first break each property into its bottom element.
source share