asp.net – 如何使用webgrease?

WebGrease是一个在mvc4中找到的程序集,但它可以像Yahoo.Yui.Compressor一样使用吗?
我想在C#控制台程序中使用webgrease.dll并将 javascript字符串压缩到另一个.
class Program
    {
        static void Main(string[] args)
        {
            Yahoo.Yui.Compressor.JavaScriptCompressor c = new Yahoo.Yui.Compressor.JavaScriptCompressor();
            string s = "function    hello (name)  {  return 'hello '+ name + '!'; }";
            s = c.Compress(s);
            Console.WriteLine(s);
        }
    }

解决方法

这是可能的,也很容易.您可以在Visual Studio文件夹中找到WG.EXE. WG.EXE实际上是命令行缩小器,它调用相同的缩小库.您可以从命令行,MSBuild或您选择的任何脚本中使用它来进行缩小.

以下是WG团队撰写的关于如何从命令行使用WG的好文章http://kenhaines.net/post/2012/06/09/WebGrease-As-seen-in-Visual-Studio-2012.aspx

你也可以查看https://webgrease.codeplex.com/documentation

了解详细信息

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....