我的css js 圖片壓縮批處理命令

來源:互聯網
上載者:User
 1 @echo off 
2 ::設定YUI Compressor啟動目錄
3 SET YUIFOLDER=D:\yuicompressor-2.4.2\build\
4
5 ::設定你的JS和CSS根目錄,指令碼會自動按樹層次尋找和壓縮所有的JS和CSS
6 SET INFOLDER=D:\jscss\src
7 SET OUTFOLDER=D:\jscss\build
8 echo 正在尋找 JavaScript, CSS ...
9 chdir /d %INFOLDER%
10
11  for /r . %%a in (*.js *.css) do (
12 copy %%a "%OUTFOLDER%\" && echo 複製%%~fa成功 || echo 複製%%~fa失敗,請檢查檔案是否存在!
13 @echo 正在壓縮 %%~a ...
14 @java -jar %YUIFOLDER%\yuicompressor-2.4.2.jar --charset UTF-8 %%~fa -o %%~fa
15 )
16 @echo CSS JS壓縮完成!
17
18 for /r . %%b in (*.gif) do (
19 @echo 正在尋找 gif...
20 @pngout %%~fb /kp
21 del /q/f %%~fb
22 )
23
24 @echo gif轉換完成!
25
26 for /r . %%c in (*.png) do (
27 @echo 正在尋找 png...
28 @pngout %%~fc
29 )
30
31 @echo png壓縮完成!
32
33 pause & exit
相關文章

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.