
Minification of JavaScript and CSS files is one of the best practices to keep your site’s load time to the minimum, especially important for the first time visitors. In organized projects, minification is part of the deployment process and it is integrated into that very smoothly using appropriate tools.
If you wish to minify the JavaScript and CSS files without pre-deployment scripts minifying the .js and .css files, your best bet is to use a command-line tool like JSMin (JavaScript files only) or YUI Compressor (supports JavaScript and CSS files, both).
To make this process even smoother, as easy as drag-and-drop, we have provided a batch file (for Windows users) which can minify multiple files in a single go. To minify, you just need to drag-and-drop any JS or CSS files into the batch file and with the help of YUI compressor, the mininfied version of the file will be created in the same folder as that of the original file.
You can even right click on a JS or CSS file and use the “Open With” option and set it to execute with the provided batch file.
Pre-requisite:
How it works:
Source code:
:top @if [%1] == [] goto argsmissing :again @if [%1] == [] goto end @echo %1 @set opfile=%~n1.min%~x1 @%~d1 @cd "%~d1%~p1" @echo %opfile% @echo. @java -jar "%~d0%~p0yuicompressor-2.4.7.jar" --nomunge --disable-optimizations %1 -o "%opfile%" @REM - Shift the arguments (do not alter first argument) and examine %1 again @shift /1 @goto again :argsmissing @echo Argument(s) missing @echo usage: batFile.bat file1.js file2.css ... @echo. :end @pause
March 22, 2013
February 24, 2013
hi, download link is corrupted…. can you check pls.
@Shah Alom: Download Link has been fixed now
this script currepted not working..check it..any video tutorial for this