I have created a service to join, minify and compress css-references on a CMS system. Example:Before :\[code\]<link href="http://stackoverflow.com/Files/css1.css" rel="stylesheet" type="text/css"/><link href="http://stackoverflow.com/Files/css2.css" rel="stylesheet" type="text/css"/><link href="http://stackoverflow.com/Files/css3.css" rel="stylesheet" type="text/css" media="all"/>\[/code\]Now you can write:\[code\]<link href="http://stackoverflow.com/min.ashx?files=/Files/css1.css,/Files/css2.css,/Files/css3.css" rel="stylesheet" type="text/css" />\[/code\]My next task is to take all references in head section AUTOMATICALLY and replace them by one single line, as seen in the example.I should only replace those that falls with in these rules:
- Href starts with '/Files/', to avoid trying to load externals externals
- Only the ones with attribute media or with a media="all" should be included, as the resulting css-file will only have one setting.