-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <code title="DouglasCrockford.JsMin.JsMinifier">JsMinifier</code> 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 <code title="DouglasCrockford.JsMin.JsMinificationException">JsMinificationException</code> exception. | ||
|
||
## License | ||
[Douglas Crockford's License](https://github.com/Taritsyn/JSMin.NET/blob/master/LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "1.0.1-rc1", | ||
"version": "1.1.0-rc1", | ||
"description": "", | ||
"authors": [ "" ], | ||
"tags": [ "" ], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters