Project: CSS inliner

From this list

Tags

Simple, AST, Command-Line, Web

Why

HTML-based e-mails require that all CSS is inlined to prevent it from clashing with the mail client’s user interface. I couldn’t find a CSS inlining tool written in Haskell yet, and it seems like a nice little project with practical uses.

What it would do is take an HTML file and search for CSS that has been applied to it, which is then inlined using the style attribute.

What you will learn / Rough implementation guide

It might be in your best interest to build on existing parsers for HTML and CSS:

HTML

CSS

Useful resources

The way you track down what CSS is applicable is down to you. handsomesoup allows extracting elements based on a CSS selector, perhaps see how it’s done?