NUglify 1.22.1
NUglify

NUglify provides minify and compression methods for CSS, JavaScript and HTML files.
This repository is a fork of the Microsoft Ajax Minifier + additional features (e.g: HTML compressor)
While dotnet Core is now relying on the node.js ecosystem for its client side tooling (e.g: minify), NUglify is still useful in scenarios where we need to access this tooling from a .NET application (not necessarily an ASP one) without having to install another developer platform.
The original AjaxMin documentation of the project is available here
See the ChangeLog
Features
- JS minification
-
- Fully ES2020 + ES2021 compliant
- Css minification
- HTML minification
- Can help to reduce by 5-10% a standard HTML document
- Supports several minifications methods: remove comments, collapse whitespaces, remove optional tags (p, li...), remove quoted attributes, remove specific attributes, decode HTML entities, compress inline style and script using NUglify
- No regex involved, full HTML parser
- Supports HTML5, works best on valid HTML documents (but can still work on invalid documents)
- Similar to the popular html-minifier in JS
- Super fast and GC friendly parser and minifier, 10x times faster than existing html compressor for .NET
- Method
Uglify.HtmlToTextthat allows to extract the text from an HTML document
- Compatible with
.NET Framework 4.0,.NET Standard 2.0, and.NET 10.0
Download
NUglify is available as a NuGet package:
Usage
Basic usage
The main entry point for the API is the Uglify class:
For JavaScript:
var result = Uglify.Js("var x = 5; var y = 6;");
Console.WriteLine(result.Code); // prints: var x=5,y=6
For Css:
var result = Uglify.Css("div { color: #FFF; }");
Console.WriteLine(result.Code); // prints: div{color:#fff}
For Html:
var result = Uglify.Html("<div> <p>This is <em> a text </em></p> </div>");
Console.WriteLine(result.Code); // prints: <div><p>This is <em>a text</em></div>
Extract text from Html:
var result = Uglify.HtmlToText("<div> <p>This is <em> a text </em></p> </div>");
Console.WriteLine(result.Code); // prints: This is a text
HTML
See the xmldoc comments on the properties of NUglify.Html.HtmlSettings for all your HTML minification needs.
For example, to output indented (with tabs) HTML:
var htmlSettings = HtmlSettings.Pretty();
htmlSettings.Indent = "\t";
var output = Uglify.Html(input, htmlSettings);
JS
TODO
CSS
TODO
Known Issues
None
Questions
- Can we collaborate with a project like Jint to leverage on a common JavaScript parser infrastructure?
- Can we utilise AngleSharp for the HTML/Css minification?
License
This package includes the repository license.txt file, which covers the BSD 2-Clause terms for NUglify and the original Apache 2.0 notice for Microsoft Ajax Minifier.
Author
Microsoft Ajax Minifier was created and maintained by Ron Logan, with contributions from Eugene Chigirinskiy, Rafael Correa, Kristoffer Henriksson, and Marcin Dobosz.
Nuglify was ported and refactored to github by Alexandre Mutel aka xoofx
It is now maintained by Jason Best aka jbest84
Previous Maintainers
Andrew Bullock aka trullock
Credits
The logo Monster is by Joel McKinney from the Noun Project
Showing the top 20 packages that depend on NUglify.
| Packages | Downloads |
|---|---|
|
BundlerMinifier.Core
Bundles and minifies CSS, JS and HTML files
|
26 |
|
BundlerMinifier.Core
Bundles and minifies CSS, JS and HTML files
|
28 |
|
BundlerMinifier.Core
Bundles and minifies CSS, JS and HTML files
|
34 |
|
Volo.Abp.AspNetCore.Mvc.UI
Package Description
|
26 |
|
Volo.Abp.AspNetCore.Mvc.UI
Package Description
|
27 |
|
Volo.Abp.AspNetCore.Mvc.UI
Package Description
|
28 |
|
Volo.Abp.AspNetCore.Mvc.UI
Package Description
|
29 |
|
Volo.Abp.AspNetCore.Mvc.UI
Package Description
|
30 |
|
Volo.Abp.Minify
Package Description
|
26 |
.NET 10.0
- No dependencies.
.NET Framework 4.0
- No dependencies.
.NET Standard 2.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 1.22.3 | 1 | 07/31/2026 |
| 1.22.2 | 1 | 07/31/2026 |
| 1.22.1 | 1 | 07/31/2026 |
| 1.22.0 | 4 | 07/27/2026 |
| 1.21.18 | 2 | 07/27/2026 |
| 1.21.17 | 19 | 08/09/2025 |
| 1.21.16 | 18 | 08/09/2025 |
| 1.21.15 | 18 | 06/05/2025 |
| 1.21.14 | 23 | 04/01/2025 |
| 1.21.13 | 19 | 03/07/2025 |
| 1.21.12 | 21 | 03/07/2025 |
| 1.21.11 | 25 | 01/19/2025 |
| 1.21.10 | 20 | 01/19/2025 |
| 1.21.9 | 20 | 01/19/2025 |
| 1.21.8 | 18 | 01/19/2025 |
| 1.21.7 | 19 | 01/19/2025 |
| 1.21.5 | 21 | 01/19/2025 |
| 1.21.4 | 23 | 01/19/2025 |
| 1.21.3 | 19 | 01/19/2025 |
| 1.21.2 | 24 | 01/19/2025 |
| 1.21.0 | 22 | 01/19/2025 |
| 1.20.7 | 20 | 01/19/2025 |
| 1.20.6 | 19 | 01/19/2025 |
| 1.20.5 | 23 | 01/19/2025 |
| 1.20.4 | 23 | 01/19/2025 |
| 1.20.3 | 17 | 03/07/2025 |
| 1.20.2 | 21 | 03/07/2025 |
| 1.20.0 | 20 | 01/19/2025 |
| 1.19.2 | 19 | 01/19/2025 |
| 1.19.1 | 21 | 01/19/2025 |
| 1.19.0 | 22 | 01/19/2025 |
| 1.18.0 | 21 | 01/19/2025 |
| 1.17.14 | 23 | 01/19/2025 |
| 1.17.13 | 20 | 01/19/2025 |
| 1.17.10 | 21 | 01/19/2025 |
| 1.17.9 | 20 | 01/19/2025 |
| 1.17.8 | 21 | 01/19/2025 |
| 1.17.7 | 20 | 01/19/2025 |
| 1.17.6 | 19 | 01/19/2025 |
| 1.17.5 | 22 | 01/19/2025 |
| 1.17.4 | 20 | 01/19/2025 |
| 1.17.3 | 20 | 01/19/2025 |
| 1.17.2 | 21 | 01/19/2025 |
| 1.17.1 | 21 | 01/19/2025 |
| 1.17.0 | 20 | 01/19/2025 |
| 1.16.4 | 23 | 01/19/2025 |
| 1.16.2 | 26 | 01/19/2025 |
| 1.16.1 | 25 | 01/19/2025 |
| 1.16.0 | 24 | 01/19/2025 |
| 1.15.0 | 25 | 01/19/2025 |
| 1.15.0-beta | 24 | 01/19/2025 |
| 1.14.0 | 23 | 01/19/2025 |
| 1.13.15 | 20 | 01/19/2025 |
| 1.13.12 | 21 | 01/19/2025 |
| 1.13.11 | 21 | 01/19/2025 |
| 1.13.10 | 21 | 01/19/2025 |
| 1.13.9 | 19 | 01/19/2025 |
| 1.13.8 | 20 | 01/19/2025 |
| 1.13.7 | 22 | 01/19/2025 |
| 1.13.6 | 18 | 01/19/2025 |
| 1.13.3 | 21 | 01/19/2025 |
| 1.13.2 | 20 | 01/19/2025 |
| 1.13.1 | 22 | 01/19/2025 |
| 1.13.0 | 19 | 01/19/2025 |
| 1.12.3 | 21 | 01/19/2025 |
| 1.12.2 | 20 | 01/19/2025 |
| 1.12.1 | 24 | 03/07/2025 |
| 1.12.0 | 22 | 01/19/2025 |
| 1.11.9 | 26 | 01/19/2025 |
| 1.11.8 | 22 | 01/19/2025 |
| 1.11.7 | 22 | 01/19/2025 |
| 1.11.6 | 20 | 01/19/2025 |
| 1.11.5 | 21 | 01/19/2025 |
| 1.11.4 | 22 | 01/19/2025 |
| 1.11.3 | 21 | 01/19/2025 |
| 1.11.1 | 24 | 01/19/2025 |
| 1.11.0 | 20 | 01/19/2025 |
| 1.10.0 | 22 | 01/19/2025 |
| 1.9.11 | 21 | 01/19/2025 |
| 1.9.9 | 21 | 01/19/2025 |
| 1.9.8 | 23 | 01/19/2025 |
| 1.9.7 | 23 | 01/19/2025 |
| 1.9.6 | 21 | 01/19/2025 |
| 1.9.5 | 25 | 01/19/2025 |
| 1.9.4 | 23 | 01/19/2025 |
| 1.9.3 | 22 | 01/19/2025 |
| 1.9.2 | 24 | 01/19/2025 |
| 1.9.1 | 22 | 01/19/2025 |
| 1.8.1 | 23 | 01/19/2025 |
| 1.7.2 | 25 | 01/19/2025 |
| 1.7.1 | 27 | 01/19/2025 |
| 1.6.6 | 25 | 01/19/2025 |
| 1.6.5 | 27 | 01/19/2025 |
| 1.6.4 | 27 | 01/19/2025 |
| 1.6.3 | 23 | 01/19/2025 |
| 1.6.2 | 23 | 01/19/2025 |
| 1.6.1 | 21 | 01/19/2025 |
| 1.6.0 | 23 | 01/19/2025 |
| 1.5.14 | 25 | 09/26/2024 |
| 1.5.13 | 20 | 01/19/2025 |
| 1.5.12 | 19 | 01/19/2025 |
| 1.5.11 | 20 | 01/19/2025 |
| 1.5.10 | 22 | 01/19/2025 |
| 1.5.9 | 23 | 01/19/2025 |
| 1.5.8 | 28 | 01/19/2025 |
| 1.5.7 | 25 | 01/19/2025 |
| 1.5.6 | 24 | 01/19/2025 |
| 1.5.5 | 23 | 01/19/2025 |
| 1.5.4 | 24 | 01/19/2025 |
| 1.5.3 | 20 | 01/19/2025 |
| 1.5.2 | 23 | 01/19/2025 |
| 1.5.1 | 25 | 01/19/2025 |
| 1.5.0 | 23 | 01/19/2025 |
| 1.4.5 | 23 | 01/19/2025 |
| 1.4.4 | 23 | 01/19/2025 |
| 1.4.3 | 23 | 01/19/2025 |
| 1.4.2 | 22 | 01/19/2025 |
| 1.4.1 | 22 | 01/19/2025 |
| 1.4.0 | 23 | 01/19/2025 |
| 1.3.0 | 25 | 01/19/2025 |
| 1.2.0 | 21 | 01/19/2025 |
| 1.1.0 | 24 | 01/19/2025 |