{"id":598,"date":"2012-05-03T15:54:53","date_gmt":"2012-05-03T15:54:53","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=598"},"modified":"2012-05-03T15:56:02","modified_gmt":"2012-05-03T15:56:02","slug":"on-the-fly-minify","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/on-the-fly-minify\/","title":{"rendered":"Need a Vacation from Minification &#8211; Try to on-the-fly minify"},"content":{"rendered":"<p>Sorry for the ridiculous post title, but I just had to. What I&#39;m talking about is the desire to keep your HTML output condensed, but not to make development difficult in the process.<\/p>\n<p>For example, if you want a custom chunk of CSS on a given page, you might want to drop inline, in your &lt;head&gt;. But, if you&#39;re like me, you can&#39;t stand it when the page source shows dozens of lines of CSS\/JS before you reach the &lt;body&gt;.<\/p>\n<p>So, why not minify that CSS on-the-fly.<\/p>\n<h2>ColdFusion example<\/h2>\n<h3>Page-specific CSS<\/h3>\n<p><code>&lt;cfsavecontent variable=&quot;mycss&quot;&gt;<br \/>\n\t&lt;style type=&quot;text\/css&quot;&gt;<br \/>\n\t&nbsp;&nbsp; h1 { font-size: 2em; }<br \/>\n\t&nbsp;&nbsp; h2 { font-size: 1.5em; }<br \/>\n\t&lt;\/style&gt;<br \/>\n\t&lt;\/cfsavecontent&gt;<br \/>\n\t<\/code><\/p>\n<p>&nbsp;<\/p>\n<h3>Main Template file<\/h3>\n<p><code>&lt;head&gt;<br \/>\n\t...<br \/>\n\t&lt;!--- nicely minified CSS code below ---&gt;<br \/>\n\t&lt;cfoutput&gt;#Replace(Replace(mycss, chr(9), &quot;&quot;, &quot;ALL&quot;), chr(13) &amp; chr(10), &quot;&quot;, &quot;ALL&quot;)#&lt;\/cfoutput&gt;&lt;\/cfif&gt;<\/code><br \/>\n\t<code>&lt;\/head&gt;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sorry for the ridiculous post title, but I just had to. What I&#39;m talking about is the desire to keep your HTML output condensed, but&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[34,12,41],"tags":[90],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/598"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=598"}],"version-history":[{"count":2,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":600,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/598\/revisions\/600"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}