html - PHP library to create inlined CSS from files or from <style> tags? -
i library create inlined css+html .html , .css files or html file tags in head. prefer php library if possible.
by inlined css mean like
<span style="font: bla bla bla">hi there!</span> versus
<style> .greeting { font: bla bla bla; } </style> i need put html emails , simplify process greatly.
if interested, current solution (for stuff isn't restyled often) use smarty templating engine create document, , assign style="" part variable inside template.
then can use variable in each tag (like <td {$td_style}> (fyi - {$variable} how smarty variables inserted template) , have generate appropriate email-friendly html.
however want more general, , can feed html , css rather have convert of smarty template.
does know if library exists?
although don't know of library handles this, if you're set on php, think using csstidy parse css, , using xml parser (ideal if code well-formed--maybe simplexml or dom extension) or 1 of php-based html parsers see out there parse html, can alter html via dom methods according css rules.
if don't need tied php process though, recommend going javascript this, since can work in client-side (and in different environments) , handy tool wishing this; should able parse css using http://glazman.org/jscssp/ , using domparser() , ie equivalent needed (for xhtml) or use innerhtml, this htmlparser, or any other html parsers.
btw, know <style> works in emails since add-on color source injects them syntax highlighting in emails, though guess saying more complicated way.
Comments
Post a Comment