• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

deanhume/html-minifier: A simple command line tool to minify your HTML, Razor vi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

deanhume/html-minifier

开源软件地址:

https://github.com/deanhume/html-minifier

开源编程语言:

C# 100.0%

开源软件介绍:

HTML Minifier

A simple command line tool to minify your HTML, Razor views & Web Forms views. By minifying your HTML on bigger web pages, you will save on bytes that your users need to donwload. Less bytes equal faster web pages & faster web pages equal happy users!

Getting Started

Go from HTML that looks like this:

<h2>
    Admin Menu</h2>
<ul>
    <li>@Html.ActionLink("Edit blog entries", "List", "Admin")</li>
    <li>@Html.ActionLink("View Comments", "CommentList", "Admin")</li>
    <li>@Html.ActionLink("Clear Cache", "ClearCache", "Admin")</li>
</ul>

To HTML that looks like this:

<h2> Admin Menu</h2><ul><li>@Html.ActionLink("Edit blog entries", "List", "Admin")</li><li>@Html.ActionLink("View Comments", "CommentList", "Admin")</li><li>@Html.ActionLink("Clear Cache", "ClearCache", "Admin")</li></ul>

Usage Examples

In order to use from the command line, you simply pass through a folder path that contains all of the files you want to minify. The minifier will process all images in the root and subfolders.

C:\>HtmlMinifier.exe "C:\Folder"

If you'd like to restrict the number of characters per line and force it to break to the next line, use the minifier with the following optional value (where the number is the max character count).

C:\>HtmlMinifier.exe "C:\Folder" "60000"

There is also the option to disable certain minification features. For example, if you use a you rely on HTML comments (Knockout, Angular, etc.) you might want to leave them in the minified HTML.

C:\>HtmlMinifier.exe "C:\Folder" ignorehtmlcomments

You can also disable the minification of JavaScript Comments

C:\>HtmlMinifier.exe "C:\Folder" ignorejscomments

If you use knockoutJS, you can optionally disable the minification of Knockout Comments

C:\>HtmlMinifier.exe "C:\Folder" ignoreknockoutcomments

If you want to minify individual folders you can do:

C:\>HtmlMinifier.exe "C:\Folder\fld1" "C:\Folder\fld2"

If you want to minify individual files you can do:

C:\>HtmlMinifier.exe "C:\Folder\file1.html" "C:\Folder\file2.html"

If you'd like to find out how to use this with MSBUILD and your next publish, please follow this link.

License

(C) Dean Hume 2019, released under the MIT license




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap