From 3ddee85b8e5692a5626a626accca7a7dacc0d4c3 Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Sat, 26 Mar 2016 12:39:05 +0300 Subject: [PATCH] Version 1.1.0 RC 1 --- NuGet/DouglasCrockford.JsMin.nuspec | 2 +- NuGet/readme.txt | 2 +- README.md | 52 +++++++++++++++++-- .../JsMinificationException.cs | 10 ++-- src/DouglasCrockford.JsMin/JsMinifier.cs | 12 ++--- .../Properties/AssemblyInfo.cs | 4 +- src/DouglasCrockford.JsMin/project.json | 2 +- .../Properties/AssemblyInfo.cs | 4 +- test/DouglasCrockford.JsMin.Test/project.json | 4 +- 9 files changed, 68 insertions(+), 24 deletions(-) diff --git a/NuGet/DouglasCrockford.JsMin.nuspec b/NuGet/DouglasCrockford.JsMin.nuspec index 6c56b6e..b5409e9 100644 --- a/NuGet/DouglasCrockford.JsMin.nuspec +++ b/NuGet/DouglasCrockford.JsMin.nuspec @@ -2,7 +2,7 @@ DouglasCrockford.JsMin - 1.0.1-rc1 + 1.1.0-rc1 JSMin for .Net Andrey Taritsyn Andrey Taritsyn diff --git a/NuGet/readme.txt b/NuGet/readme.txt index 83ca81a..04a289e 100644 --- a/NuGet/readme.txt +++ b/NuGet/readme.txt @@ -1,7 +1,7 @@  ---------------------------------------------------------------------- - README file for JSMin for .Net v1.0.1 RC 1 + README file for JSMin for .Net v1.1.0 RC 1 ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 2f17487..f8b8bcb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,54 @@ JSMin for .Net ============== -A .NET port of the [Douglas Crockford's JSMin](http://github.com/douglascrockford/JSMin). +JSMin.NET is a .NET port of the [Douglas Crockford's JSMin](http://github.com/douglascrockford/JSMin). -#Installation +## Installation This library can be installed through NuGet - [http://nuget.org/packages/DouglasCrockford.JsMin](http://nuget.org/packages/DouglasCrockford.JsMin). -# License -[Douglas Crockford's License](https://github.com/Taritsyn/JSMin.NET/blob/master/LICENSE) +## Usage +Consider a simple example of usage of the JSMin.NET: + +```csharp +using System; + +using DouglasCrockford.JsMin; + +namespace TestJsMinDotNet +{ + class Program + { + static void Main(string[] args) + { + const string code = @"function square(num) { + return num * num; +}"; + var minifier = new JsMinifier(); + + try + { + string result = minifier.Minify(code); + + Console.WriteLine("Result of JavaScript minification:"); + Console.WriteLine(); + Console.WriteLine(result); + } + catch (JsMinificationException e) + { + Console.WriteLine("During minification of JavaScript code an error occurred:"); + Console.WriteLine(); + Console.WriteLine(e.Message); + } + + Console.ReadLine(); + } + } +} +``` + +First we create an instance of the JsMinifier class. +Then we minify a JavaScript code by using of the `Minify` method and output its result to the console. +In addition, we provide handling of the JsMinificationException exception. + +## License +[Douglas Crockford's License](https://github.com/Taritsyn/JSMin.NET/blob/master/LICENSE) \ No newline at end of file diff --git a/src/DouglasCrockford.JsMin/JsMinificationException.cs b/src/DouglasCrockford.JsMin/JsMinificationException.cs index c6a0cc0..663a2c9 100644 --- a/src/DouglasCrockford.JsMin/JsMinificationException.cs +++ b/src/DouglasCrockford.JsMin/JsMinificationException.cs @@ -8,8 +8,8 @@ public sealed class JsMinificationException : Exception { /// - /// Initializes a new instance of the DouglasCrockford.JsMin.JsMinificationException - /// class with a specified error message + /// Initializes a new instance of the class + /// with a specified error message /// /// The message that describes the error public JsMinificationException(string message) @@ -17,9 +17,9 @@ public JsMinificationException(string message) { } /// - /// Initializes a new instance of the DouglasCrockford.JsMin.JsMinificationException - /// class with a specified error message and a reference to the inner exception that is the cause of - /// this exception + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is + /// the cause of this exception /// /// The error message that explains the reason for the exception /// The exception that is the cause of the current exception diff --git a/src/DouglasCrockford.JsMin/JsMinifier.cs b/src/DouglasCrockford.JsMin/JsMinifier.cs index 6d28d05..1032150 100644 --- a/src/DouglasCrockford.JsMin/JsMinifier.cs +++ b/src/DouglasCrockford.JsMin/JsMinifier.cs @@ -36,14 +36,14 @@ namespace DouglasCrockford.JsMin /// /// The JavaScript Minifier /// - public sealed class JsMinifier - { - const int EOF = -1; + public sealed class JsMinifier + { + const int EOF = -1; private StringReader _reader; private StringWriter _writer; - private int _theA; + private int _theA; private int _theB; private int _theLookahead = EOF; private int _theX = EOF; @@ -413,8 +413,8 @@ private void InnerMinify() /// /// The character private void Put(int c) - { - _writer.Write((char)c); + { + _writer.Write((char)c); } #endregion diff --git a/src/DouglasCrockford.JsMin/Properties/AssemblyInfo.cs b/src/DouglasCrockford.JsMin/Properties/AssemblyInfo.cs index a603303..d6dda70 100644 --- a/src/DouglasCrockford.JsMin/Properties/AssemblyInfo.cs +++ b/src/DouglasCrockford.JsMin/Properties/AssemblyInfo.cs @@ -15,5 +15,5 @@ [assembly: Guid("0d7b205c-e3d6-4756-9977-29a71052536b")] #endif -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] \ No newline at end of file diff --git a/src/DouglasCrockford.JsMin/project.json b/src/DouglasCrockford.JsMin/project.json index 8378e31..d44544e 100644 --- a/src/DouglasCrockford.JsMin/project.json +++ b/src/DouglasCrockford.JsMin/project.json @@ -1,5 +1,5 @@ { - "version": "1.0.1-rc1", + "version": "1.1.0-rc1", "description": "", "authors": [ "" ], "tags": [ "" ], diff --git a/test/DouglasCrockford.JsMin.Test/Properties/AssemblyInfo.cs b/test/DouglasCrockford.JsMin.Test/Properties/AssemblyInfo.cs index e697337..db52fec 100644 --- a/test/DouglasCrockford.JsMin.Test/Properties/AssemblyInfo.cs +++ b/test/DouglasCrockford.JsMin.Test/Properties/AssemblyInfo.cs @@ -15,5 +15,5 @@ [assembly: Guid("72947ee4-f2b3-42e9-a84b-9a4a5254e974")] #endif -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] \ No newline at end of file diff --git a/test/DouglasCrockford.JsMin.Test/project.json b/test/DouglasCrockford.JsMin.Test/project.json index 83f5bac..c5126b7 100644 --- a/test/DouglasCrockford.JsMin.Test/project.json +++ b/test/DouglasCrockford.JsMin.Test/project.json @@ -1,5 +1,5 @@ { - "version": "1.0.1-rc1", + "version": "1.1.0-rc1", "description": "", "authors": [ "" ], "tags": [ "" ], @@ -13,7 +13,7 @@ "dependencies": { "xunit": "2.1.0", "xunit.runner.dnx": "2.1.0-rc1-build204", - "DouglasCrockford.JsMin": "1.0.1-rc1" + "DouglasCrockford.JsMin": "1.1.0-rc1" }, "commands": {