简体   繁体   English

Visual Studio Web部署项目自动压缩js和CSS

[英]Visual Studio Web Deployment project auto compress js and css

Is there a way to make the web deployment project automatically compress js and css files when building it? 有没有一种方法可以使Web部署项目在构建时自动压缩js和CSS文件? how can I automate this process? 我如何使这个过程自动化?

You can accomplish that by adding an MSBuild task to your web deployment project that would compress your JS and CSS for you. 您可以通过在Web部署项目中添加MSBuild任务来完成此任务,该任务将为您压缩JS和CSS。 Here is an example using the YUI compressor. 这是使用YUI压缩器的示例

You could also do something similar with other compression libraries by using the Exec MSBuild task to execute a command line compression tool. 您还可以通过使用Exec MSBuild任务执行命令行压缩工具,对其他压缩库执行类似的操作。

如果使用的是构建服务器(团队构建或其他构建服务器),则可能会找到或肯定会构建一个自定义任务来处理此问题。

Pithy is what we use. Pithy是我们使用的。

http://github.com/clearwavebuild/Pithy/tree/2009.12.22.1000 http://github.com/clearwavebuild/Pithy/tree/2009.12.22.1000

Has nice preprocessor support, too. 也有很好的预处理器支持。 (dotlesscss) (dotlesscss)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM