cssvisual-studio-2010minifycsstidy

How prevent CSSTidy from removing the *property IE7 Hack? (Or another standalone tool)


Bounty: Bounty given to whoever share a standalone command-line CSS minifier for Windows (that is, run just like JSMin and CSSTidy, but actually minifies rather than 'prettify' and remove properties

Using Visual Studio 2010 Post-Build Events, I'm currently working to reduce our CSS/JS framework by merging and minifying the files into .min for production when building the solution/project.

For the JS I'm using JSmin.exe while for CSS, CSSTidy.exe

All okay for JSmin, but CSSTidy is removing all IE7 *property hacks and other properties used by display-table.htc (-dt-display:). If I use the --preserve_css=true setting, it keeps the comments (which I don't want) and the *property have the * stripped out (which I want).

Example:

.row-fluid .span1 {width: 6.382978723%; *width: 6.329787233638298%;}

Becomes (note it added linebreak as well):

.row-fluid .span1 {
width:6.382979%;
width:6.329787%
}

The question made here is what I'm looking for BUT the answer was given for HTML Purifier (which I don't use) instead of a CSSTidy alternative.

So the questions:

Obs.: The VS solution is TFS shared, can't make all devs install YUI or whatever other framework which isn't standalone, nor other languages frameworks like Ruby/PHP. Currently the jsmin.exe and csstidy.exe were the best since I just added both to the solution and call them on post-events.


Solution

  • After spending all Friday searching and not finding a good tool, today I gave a new shot and finally found a tool that minify both CSS and JS.

    The name isn't much straightforward, that's why was hard to find: Microsoft Ajax Minifier

    While asks for install, I just copied the folder contents to the project and worked like a charm.


    For those who want to use it as Post-Event build:

    Considering you have a .js folder and you want to concatenate and minify all .js files that end with .debug.js.

    type "$(ProjectDir)\Scripts\*.debug.js" | "$(ProjectDir)tools\AjaxMin" -JS -comments:none –global:jQuery,$ -out "$(ProjectDir)\Scripts\myProject.min.js" -clobber
    

    Now everytime I need to update my css and js files, I re/build the project and voilá, minified CSS and JS.