Trim "Minify" inline css at runtime, expand it at edit time.
Posted
by Scott B
on Stack Overflow
See other posts from Stack Overflow
or by Scott B
Published on 2010-04-05T14:36:30Z
Indexed on
2010/04/05
14:43 UTC
Read the original article
Hit count: 414
php
My custom WP theme has a text block in the theme options panel that allows the user to create and maintain a custom css block that is applied to the site template at runtime.
I would like to trim or "minify" this content before its stored in the database, but retain all the whitespace when its presented back to the user for editing.
Would this be possible?
For example, if the user has entered the following as their custom css code...
.red {color:red;}
.green {color:green;}
.blue {color:blue;}
Then I would like to store it in the database as:
.red{color:red;}.green{color:green;}.blue{color:blue;}
But still display it as it was input (ie, retain all the white space and line breaks) when the user is editing the content via my theme options panel.
© Stack Overflow or respective owner