C# Class WebMarkupMin.Core.DouglasCrockford.JsMinifier

The JavaScript Minifier
Show file Open project: Taritsyn/WebMarkupMin Class Usage Examples

Public Methods

Method Description
Minify ( string content ) : String

Removes a comments and unnecessary whitespace from JavaScript code

Private Methods

Method Description
Action ( int d ) : void

Do something! What you do is determined by the argument: 1 - Output A. Copy B to A. Get the next B. 2 - Copy B to A. Get the next B. (Delete A). 3 - Get the next B. (Delete B). Action treats a string as a single character. Wow! Action recognizes a regular expression if it is preceded by ( or , or =.

Get ( ) : int

Returns a next character from input stream. Watch out for lookahead. If the character is a control character, translate it to a space or linefeed.

InnerMinify ( ) : void

Copies a input to the output, deleting the characters which are insignificant to JavaScript. Comments will be removed. Tabs will be replaced with spaces. Carriage returns will be replaced with linefeeds. Most spaces and linefeeds will be removed.

IsAlphanum ( int c ) : bool

Returns a true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character

Next ( ) : int

Gets a next character, excluding comments. Peek() is used to see if a '/' is followed by a '/' or '*'.

Peek ( ) : int

Gets a next character without getting it

Put ( int c ) : void

Puts a character to output stream

Method Details

Minify() public method

Removes a comments and unnecessary whitespace from JavaScript code
public Minify ( string content ) : String
content string JavaScript content
return String