How can I merge CSS definitions in files into inline style attributes, using Perl?
        Posted  
        
            by mintywalker
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mintywalker
        
        
        
        Published on 2009-08-13T11:34:20Z
        Indexed on 
            2010/04/28
            20:37 UTC
        
        
        Read the original article
        Hit count: 280
        
Many email clients don't like linked CSS stylesheets, or even the embedded <style> tag, but rather want the CSS to appear inline as style attributes on all your markup.
- BAD: <link rel=stylesheet type="text/css" href="/style.css">
- BAD: <style type="text/css">...</style>
- WORKS: <h1 style="margin: 0">...</h1>
However this inline style attribute approach is a right pain to manage.
I've found tools for Ruby and PHP that will take a CSS file and some separate markup as input and return you the merged result - a single file of markup with all the CSS converted to style attributes.
I'm looking for a Perl solution to this problem, but I've not found one on CPAN or by searching Google. Any pointers? Alternatively, are there CPAN modules one could combine to achieve the same result?
© Stack Overflow or respective owner