Copy Code code as follows:
@echo off
:: Set YUI compressor start directory
SET yuifolder=d:\yuicompressor-2.4.2\build\
:: Set your JS and CSS root directory, the script will automatically find and compress all JS and CSS at the tree level
SET INFOLDER=D:\JSCSS\SRC
SET Outfolder=d:\jscss\build
Echo is looking for JavaScript, CSS ...
CHDIR/D%infolder%
For/r. %%a in (*.js *.css) do (
Copy%%a "%outfolder%\" && echo replication%%~fa Success | | echo Replication%%~fa failed, please check if file exists!
The @echo is compressing%%~a ...
@java-jar%yuifolder%\yuicompressor-2.4.2.jar--charset UTF-8%%~fa-o%%~FA
)
@echo CSS JS Compression complete!
For/r. %%b in (*.gif) do (
@echo Looking for GIF ...
@pngout%%~FB/KP
del/q/f%%~FB
)
@echo GIF conversion complete!
For/r. %%c in (*.png) do (
@echo Looking for PNG ...
@pngout%%~FC
)
@echo PNG compression complete!
Pause & Exit