Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (39 sloc) 1.28 KB


In addition to the command line tool, MiniME can also be invoked programmatically through a programming interface (API) from any .NET client program. This can be used to dynamically obfuscate JavaScript files directly on an ASP.NET server.

  1. Before using MiniME programmatically, you must add a reference to it from your .NET project.
    Depending on your development environment this might be done in any of a number of different ways - please consult the documentation for your development tool.

  2. Create an instance of the MiniMI Compiler object. eg:

    // Create an instance of the MiniME minifier
    var mm = new MiniME.Compiler();
  3. Set MiniME options. eg:

    // Setup options
    mm.MaxLineLength = 0;
  4. Add files to process:

    // Add files
    mm.AddFile("MyJavaScriptFile.js", Encoding.UTF8)

    or, add script directly

    mm.AddScript("snippet", "<javascript code here>");
  5. Compile the script

    // Compile and write to an output file

    or, compile to a string

    var ObfuscatedScript=mm.CompileToString();
  6. That's it!

See also Command Line and MiniME In-script Directives.