Is there a .Net CSS parser that will allow me to parse css shorthand properties into their longhand form?
For example I'd like to take the following:
#somediv{
margin: 10px;
padding: 10px 20px;
border:5px solid #FFF;
}
And translate it to:
#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 I'd need to handle in this manner: http://www.dustindiaz.com/css-shorthand/
Ideally I'd like something in .Net but if there's something in another language that's open source I can probably adapt it.
Update
Without getting into too much detail as to exactly what I'm trying to do here is the basic premise:
I need to programmaticly take multiple CSS docs and merge them to create one definitive set of CSS.
So if doc 1 has :
p { padding: 10px;}
And then I add on doc 2:
p { padding-left:20px;}
The resulting CSS should be:
p { padding-top: 10px; padding-right:10px; padding-bottom:10px; padding-left:20px;}
Because the later added doc overwrites the single property. To do this accurately I would need to take every CSS and break down every property to it's lowest element first.