如何组合和压缩多个脚本和 css 文件以供生产使用? [英] How can I combine and compress multiple script and css files for production use?

查看:15
本文介绍了如何组合和压缩多个脚本和 css 文件以供生产使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用YUI Compressor组合和压缩当我编译我的项目时,我的 css 和 js 文件集.YUI Compressor 仅将单个文件作为输入.我尝试使用以下(Windows)命令附加到输出文件,但在出现附加的输出中出现奇怪的字符.如何使用 windows 命令行或 powershell 来实现这一点?

I want to use YUI Compressor to combine and compress my css and js file sets when I compile my project. YUI Compressor only takes as input single files. I've tried using the following (Windows) commands to append to the output files, but strange characters appear in the output where appendage occurs. How can I use windows command line or powershell to achieve this?

java -jar yuicompressor-2.4.2.jar --charset utf-8 jquery-1.3.2.js > scripts-all.min.js
java -jar yuicompressor-2.4.2.jar --charset utf-8 jquery.superfish.js >> scripts-all.min.js

推荐答案

如果您在 Windows 上进行开发,请不要忘记 YUI Compressor 的 .NET 端口.您可以将所有这些作为 Visual Studio 中的构建后事件、作为 TFS 构建的一部分来完成,或者只是将 dll 导入您的应用程序并在其中使用它(例如,动态压缩).

If you're developing on Windows, don't forget there's a .NET port of YUI Compressor. You can do all that as a post-build event in visual studio, as part of a TFS Build or just import the dll's into your application and use it in that (eg. compressing on the fly).

这篇关于如何组合和压缩多个脚本和 css 文件以供生产使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆