Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use batch processing to achieve css and js Image Compression

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly describes how to use batch processing to achieve css and js image compression, the text is very detailed, has a certain reference value, interested friends must read!

The code is as follows:

@echo off :: Set YUI Compressor startup directory SET YUIFOLDER=D:\yuicompressor-2.4.2\build\ :: Set your JS and CSS root directory, script will automatically find and compress all JS and CSS by tree hierarchy SET INFOLDER =D:\jscss\src SET OUTFOLDER=D:\jscss\build echo Looking for JavaScript, CSS... chdir /d %INFOLDER% for /r . %%a in (*.js *.css) do ( copy %%a "%OUTFOLDER%\" && echo copy %%~fa succeeded|| echo Failed to copy %%~fa, please check if the file exists! @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 above is "how to use batch processing to achieve css and js image compression" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report