{"id":846,"date":"2009-09-23T23:53:14","date_gmt":"2009-09-24T04:53:14","guid":{"rendered":"http:\/\/www.phpied.com\/?p=846"},"modified":"2009-09-24T16:27:45","modified_gmt":"2009-09-24T21:27:45","slug":"cssmin-js","status":"publish","type":"post","link":"https:\/\/www.phpied.com\/cssmin-js\/","title":{"rendered":"cssmin.js"},"content":{"rendered":"<p>cssmin.js is a JavaScript port of YUICompressor's CSS minifier.<\/p>\n<h3>The motivation<\/h3>\n<p>Minifying CSS helps reduce file sizes and makes your pages faster and your users happier. YUICompressor is cool but is written in Java, which can be a blocker for some folks - you know JVM, command line, classpaths... No more excuses, now you have a simple light JavaScript version. And as you know, JavaScript is everywhere, so you can run it however you want, integrate with your editor and so on. <\/p>\n<h3>The links<\/h3>\n<ul>\n<li><a href=\"http:\/\/tools.w3clubs.com\/cssmin\/\">online demo<\/a><\/li>\n<li><a href=\"http:\/\/github.com\/stoyan\/yuicompressor\/blob\/master\/ports\/js\/cssmin.js\">the code on github<\/a><\/li>\n<\/ul>\n<h3>The integration<\/h3>\n<p>If you want to integrate the library into your environment, it's really easy. It's just one file with one function in it. So, just a simple function call:<\/p>\n<div class=\"hl-main\">\n<pre><span class=\"hl-reserved\">var<\/span><span class=\"hl-code\"> <\/span><span class=\"hl-identifier\">result<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-identifier\">YAHOO<\/span><span class=\"hl-code\">.<\/span><span class=\"hl-identifier\">compressor<\/span><span class=\"hl-code\">.<\/span><span class=\"hl-identifier\">cssmin<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-identifier\">input_css_code<\/span><span class=\"hl-brackets\">)<\/span><span class=\"hl-code\">;<\/span><\/pre>\n<\/div>\n<h3>The credits<\/h3>\n<p><a href=\"http:\/\/www.julienlecomte.net\/\">Julien Lecomte<\/a> - creator of <a href=\"http:\/\/developer.yahoo.com\/yui\/compressor\/\">YUICompressor<\/a><br \/>\n<a href=\"http:\/\/foohack.com\/\">Isaac Schlueter<\/a> - he maintains the YUICompressor and is the author of the original cssmin utility which was ported to Java by Julien. <\/p>\n<p>Ha, what about a quiz? Guess the language of Isaac's original cssmin and I'll send you a free copy of <a href=\"http:\/\/www.amazon.com\/dp\/0596522304\/?tag=w3clubs-20\">Even Faster WebSites<\/a> and I'll sign my chapter. Seriously.<\/p>\n<p>UPDATE: For Ruby folks, there's a <a href=\"http:\/\/github.com\/rgrove\/cssmin\/blob\/master\/lib\/cssmin.rb\">Ruby port<\/a> from the <a href=\"http:\/\/wonko.com\">Ryan Grove<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>cssmin.js is a JavaScript port of YUICompressor&#8217;s CSS minifier. The motivation Minifying CSS helps reduce file sizes and makes your pages faster and your users happier. YUICompressor is cool but is written in Java, which can be a blocker for some folks &#8211; you know JVM, command line, classpaths&#8230; No more excuses, now you have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,5,43,28],"tags":[245,370,244,261,377],"_links":{"self":[{"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/posts\/846"}],"collection":[{"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/comments?post=846"}],"version-history":[{"count":0,"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/posts\/846\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/media?parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/categories?post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpied.com\/wp-json\/wp\/v2\/tags?post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}