{"id":610,"date":"2007-05-22T22:32:55","date_gmt":"2007-05-22T20:32:55","guid":{"rendered":"http:\/\/planetozh.com\/blog\/2007\/05\/one-click-css-tidy-cleaning\/"},"modified":"2007-05-22T22:32:55","modified_gmt":"2007-05-22T20:32:55","slug":"one-click-css-tidy-cleaning","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2007\/05\/one-click-css-tidy-cleaning\/","title":{"rendered":"One-Click CSS Tidy Cleaning"},"content":{"rendered":"<p>I&#39;ve been using <a href=\"http:\/\/csstidy.sourceforge.net\/\">CSSTidy<\/a> lately, and I like it a lot. This is a pretty cool software that optimizes CSS files so that they are smaller and cleaner. It comes with a bunch of options and is available in Linux, OSX and Windows flavors.<\/p>\n<p><img src='https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2007\/05\/csstidy_context_menu.gif' alt='CSSTidy context menu' class=\"imgcenter\" \/> I&#39;m running Windows on my test computer, and I made a convenient right click context menu on CSS files so I can clean them in one click. Here&#39;s how I did it:<br \/>\n<!--more--><\/p>\n<ol>\n<li>Download <a href=\"http:\/\/csstidy.sourceforge.net\/\">CSSTidy<\/a> of course, and put the executable file <em>csstidy.exe<\/em> in, say, <em>d:\\utils\\csstidy\\<\/em><\/li>\n<li>Create the following file <strong>csstidy.bat<\/strong> in the same directory :\n<div class=\"igsh-code-box\" id=\"ig-sh-1\"><pre class=\"language-none line-numbers\" data-no-optimize=\"1\" data-cfasync=\"false\"><code class=\"language-none\">@echo off\r\nif &quot;%1&quot;==&quot;&quot; goto notok\r\n\r\ncopy %1 %~d1%~p1%~n1.orig%~x1\r\nd:\\utils\\csstidy\\csstidy.exe %1 --preserve_css=false --remove_bslash=false --compress_colors=true --lowercase_s=true --timestamp=false --remove_last_;=true --compress_font-weight=true --allow_html_in_templates=false --silent=false --case_properties=1 --sort_properties=false --merge_selectors=0 --sort_selectors=false --template=default %1\r\ngoto end\r\n\r\n:notok\r\necho Missing parameter: no filename !\r\npause\r\n\r\n:end<\/code><\/pre><\/div>\n<p>This bat file is a wrapper that will first backup your myfile.css to myfile.orig.css, then call csstidy.exe with pretty standard options: remove comments, remove indents, keep the file readable, etc&#8230;<\/li>\n<li>Now let&#39;s add the neato context menu to .css files :\n<ul>\n<li>Open the Control Panel and choose Folder Options. Select the &#39;File Types&#39; tab, and look for the &#39;CSS&#39; item. Click on &#39;Advanced&#39;, then click on &#39;New&quot;\u00a6&#39;<\/li>\n<li>In &#39;Action&#39;, type &#39;CSSTidy&#39;, and in &#39;Application used to perform action&#39;, enter the following command:\n<div class=\"igsh-code-box\" id=\"ig-sh-2\"><pre class=\"language-none line-numbers\" data-no-optimize=\"1\" data-cfasync=\"false\"><code class=\"language-none\">d:\\utils\\csstidy\\csstidy.bat &quot;%1&quot;<\/code><\/pre><\/div>\n<\/li>\n<\/li>\n<\/ol>\n<p>You&#39;re done ! It even works the same if you select multiple CSS files, right-click and pick CSSTidy in the context menu. Of course, remember to change the paths to reflect your own installation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#39;ve been using CSSTidy lately, and I like it a lot. This is a pretty cool software that optimizes CSS files so that they are smaller and cleaner. It comes with a bunch of options and is available in Linux, OSX and Windows flavors. I&#39;m running Windows on my test computer, and I made a convenient right click context menu\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[2,55,207,4],"class_list":["post-610","post","type-post","status-publish","format-standard","hentry","tag-code","tag-css","tag-csstidy","tag-windows"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=610"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/610\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}