JavaScript minifier strips white space and comments from JavaScript code. Based on Douglas Crockford's JavaScript Minifier with some modification to support string and StreamReader conversions.
This class can minify strings in memory or files and entire directories of disk files.
The MinifyDirectory() method can be used in the build process for VS or can easily be used at application startup to automatically create minified script files for an application.
Westwind.Web.JavaScriptMinifier
public class JavaScriptMinifier : object
Class Members
Member | Description | |
---|---|---|
Constructor |
||
Minify |
Minifies a source file into a target file. public void Minify(string sourceFile, string targetFile) |
|
MinifyDirectory |
Minifies all JavaScript files in a given directory and writes out the minified files to a new file extensions (.min.js for example). public static void MinifyDirectory(string path, string minExtension, bool recursive) |
|
MinifyString |
Minifies a JavaScript code string into a minified string. public string MinifyString(string sourceJavaScriptString) |
Requirements
Namespace: Westwind.WebAssembly: westwind.web.dll
© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic