File tree Expand file tree Collapse file tree
src/DouglasCrockford.JsMin
test/DouglasCrockford.JsMin.Test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22<package xmlns =" http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd" >
33 <metadata >
44 <id >DouglasCrockford.JsMin</id >
5- <version >1.0.1 -rc1</version >
5+ <version >1.1.0 -rc1</version >
66 <title >JSMin for .Net</title >
77 <authors >Andrey Taritsyn</authors >
88 <owners >Andrey Taritsyn</owners >
Original file line number Diff line number Diff line change 11
22
33 ----------------------------------------------------------------------
4- README file for JSMin for .Net v1.0.1 RC 1
4+ README file for JSMin for .Net v1.1.0 RC 1
55
66 ----------------------------------------------------------------------
77
Original file line number Diff line number Diff line change 11JSMin for .Net
22==============
33
4- A .NET port of the [ Douglas Crockford's JSMin] ( http://github.com/douglascrockford/JSMin ) .
4+ JSMin.NET is a .NET port of the [ Douglas Crockford's JSMin] ( http://github.com/douglascrockford/JSMin ) .
55
6- #Installation
6+ ## Installation
77This library can be installed through NuGet - [ http://nuget.org/packages/DouglasCrockford.JsMin ] ( http://nuget.org/packages/DouglasCrockford.JsMin ) .
88
9- # License
10- [ Douglas Crockford's License] ( https://github.com/Taritsyn/JSMin.NET/blob/master/LICENSE )
9+ ## Usage
10+ Consider a simple example of usage of the JSMin.NET:
11+
12+ ``` csharp
13+ using System ;
14+
15+ using DouglasCrockford .JsMin ;
16+
17+ namespace TestJsMinDotNet
18+ {
19+ class Program
20+ {
21+ static void Main (string [] args )
22+ {
23+ const string code = @" function square(num) {
24+ return num * num;
25+ }" ;
26+ var minifier = new JsMinifier ();
27+
28+ try
29+ {
30+ string result = minifier .Minify (code );
31+
32+ Console .WriteLine (" Result of JavaScript minification:" );
33+ Console .WriteLine ();
34+ Console .WriteLine (result );
35+ }
36+ catch (JsMinificationException e )
37+ {
38+ Console .WriteLine (" During minification of JavaScript code an error occurred:" );
39+ Console .WriteLine ();
40+ Console .WriteLine (e .Message );
41+ }
42+
43+ Console .ReadLine ();
44+ }
45+ }
46+ }
47+ ```
48+
49+ First we create an instance of the <code title =" DouglasCrockford.JsMin.JsMinifier " >JsMinifier</code > class.
50+ Then we minify a JavaScript code by using of the ` Minify ` method and output its result to the console.
51+ In addition, we provide handling of the <code title =" DouglasCrockford.JsMin.JsMinificationException " >JsMinificationException</code > exception.
52+
53+ ## License
54+ [ Douglas Crockford's License] ( https://github.com/Taritsyn/JSMin.NET/blob/master/LICENSE )
Original file line number Diff line number Diff line change 88 public sealed class JsMinificationException : Exception
99 {
1010 /// <summary>
11- /// Initializes a new instance of the DouglasCrockford.JsMin. JsMinificationException
12- /// class with a specified error message
11+ /// Initializes a new instance of the <see cref=" JsMinificationException"/> class
12+ /// with a specified error message
1313 /// </summary>
1414 /// <param name="message">The message that describes the error</param>
1515 public JsMinificationException ( string message )
1616 : base ( message )
1717 { }
1818
1919 /// <summary>
20- /// Initializes a new instance of the DouglasCrockford.JsMin. JsMinificationException
21- /// class with a specified error message and a reference to the inner exception that is the cause of
22- /// this exception
20+ /// Initializes a new instance of the <see cref=" JsMinificationException"/> class
21+ /// with a specified error message and a reference to the inner exception that is
22+ /// the cause of this exception
2323 /// </summary>
2424 /// <param name="message">The error message that explains the reason for the exception</param>
2525 /// <param name="innerException">The exception that is the cause of the current exception</param>
Original file line number Diff line number Diff line change @@ -36,14 +36,14 @@ namespace DouglasCrockford.JsMin
3636 /// <summary>
3737 /// The JavaScript Minifier
3838 /// </summary>
39- public sealed class JsMinifier
40- {
41- const int EOF = - 1 ;
39+ public sealed class JsMinifier
40+ {
41+ const int EOF = - 1 ;
4242
4343 private StringReader _reader ;
4444 private StringWriter _writer ;
4545
46- private int _theA ;
46+ private int _theA ;
4747 private int _theB ;
4848 private int _theLookahead = EOF ;
4949 private int _theX = EOF ;
@@ -413,8 +413,8 @@ private void InnerMinify()
413413 /// </summary>
414414 /// <param name="c">The character</param>
415415 private void Put ( int c )
416- {
417- _writer . Write ( ( char ) c ) ;
416+ {
417+ _writer . Write ( ( char ) c ) ;
418418 }
419419
420420 #endregion
Original file line number Diff line number Diff line change 1515[ assembly: Guid ( "0d7b205c-e3d6-4756-9977-29a71052536b" ) ]
1616#endif
1717
18- [ assembly: AssemblyVersion ( "1.0.1 .0" ) ]
19- [ assembly: AssemblyFileVersion ( "1.0.1 .0" ) ]
18+ [ assembly: AssemblyVersion ( "1.1.0 .0" ) ]
19+ [ assembly: AssemblyFileVersion ( "1.1.0 .0" ) ]
Original file line number Diff line number Diff line change 11{
2- "version" : " 1.0.1 -rc1" ,
2+ "version" : " 1.1.0 -rc1" ,
33 "description" : " " ,
44 "authors" : [ " " ],
55 "tags" : [ " " ],
Original file line number Diff line number Diff line change 1515[ assembly: Guid ( "72947ee4-f2b3-42e9-a84b-9a4a5254e974" ) ]
1616#endif
1717
18- [ assembly: AssemblyVersion ( "1.0.1 .0" ) ]
19- [ assembly: AssemblyFileVersion ( "1.0.1 .0" ) ]
18+ [ assembly: AssemblyVersion ( "1.1.0 .0" ) ]
19+ [ assembly: AssemblyFileVersion ( "1.1.0 .0" ) ]
Original file line number Diff line number Diff line change 11{
2- "version" : " 1.0.1 -rc1" ,
2+ "version" : " 1.1.0 -rc1" ,
33 "description" : " " ,
44 "authors" : [ " " ],
55 "tags" : [ " " ],
1313 "dependencies" : {
1414 "xunit" : " 2.1.0" ,
1515 "xunit.runner.dnx" : " 2.1.0-rc1-build204" ,
16- "DouglasCrockford.JsMin" : " 1.0.1 -rc1"
16+ "DouglasCrockford.JsMin" : " 1.1.0 -rc1"
1717 },
1818
1919 "commands" : {
You can’t perform that action at this time.
0 commit comments