Css js Image Compression Batch Processing Command (based on YUI Compressor)

Source: Internet
Author: User

Copy codeThe Code is as follows: @ echo off
: Set the YUI Compressor startup directory
Set yuifolder = D: \ yuicompressor-2.4.2 \ build \

: Set Your JS and CSS root directories. The script will automatically search for and compress all JS and CSS layers by tree.
Set infolder = D: \ jscss \ src
Set outfolder = D: \ jscss \ build
Echo is searching for JavaScript, CSS...
Chdir/d % INFOLDER %

For/r. % a in (*. js *. css) do (
Copy % a "% OUTFOLDER % \" & echo copy % ~ Fa succeeded | echo copy % ~ Fa failed. Check whether the file exists!
@ Echo compressing % ~ A...
@ Java-jar % YUIFOLDER % \ yuicompressor-2.4.2.jar -- charset UTF-8 % ~ Fa-o % ~ Fa
)
@ Echo css js compression completed!

For/r. % B in (*. gif) do (
@ Echo: Searching for gif...
@ Pngout % ~ Fb/kp
Del/q/f % ~ Fb
)

@ Echo gif conversion completed!

For/r. % c in (*. png) do (
@ Echo is searching for png...
@ Pngout % ~ Fc
)

@ Echo png compression completed!

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.