The Drexel physics department moved most of its content off of the department servers and onto college servers this quarter. The college servers manage their content with SiteCore, so there was a reasonable amount of trouble getting everything over (see SiteCorePy). Luckily, I got lots of help, and now I don't have to worry about the content that has migrated :). However, not all of the content made the switch.

We have a number of forms and databases that stayed on our department servers, and it's my job to make sure those pages look similar to the SiteCore pages that link to them. No problem, you say, just clone the SiteCore page's CSS, and apply it to the local pages. That's exactly what I want to do, but the jittery folks upstream keep changing the CSS, so my cloned CSS gets out of sync fairly quickly. To minimize my suffering, I've written a little script to automate the task of cloning another page's CSS.

get css.py scrapes an (X)HTML page for stylesheets (assuming there is no embedded styling in the HTML itself). It then downloads all those CSS files, cleans them up with cssutils, and saves a single clone stylesheet mimicking their behaviour. It also downloads all media referenced via url(...) entries in the CSS (e.g. background images), and adjusts the CSS to point to the local copies.