CSS JS image compression batch processing command (based on Yui compressor) _dos/bat

Source: Internet
Author: User
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.