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:
- Is it possible to make CSSTidy NOT remove the IE7 hacks nor other invalid properties (which I actually use)?
- Is there any other standalone/command-line CSS compressor (specially one which actually minifies rather than just tidy it)? (bounty for that)
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.
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
.$(ProjectDir)
is the project folder;type
is acmd.exe
command for displaying the contents of one or more files. So I order to get the contents of all *.debug.js files and leave in theSTDIN
;.exe
that I copied to my\tools\
folder;-argName:argValue
;-out
and a pathname with a file that will be outputted;-clobber
to overwrite if file existsNow everytime I need to update my css and js files, I re/build the project and voilá, minified CSS and JS.