Skip to content
This repository has been archived by the owner on Nov 30, 2018. It is now read-only.

Latest commit

 

History

History
27 lines (21 loc) · 1.68 KB

Optimizing-On-Dot-Net.html.md

File metadata and controls

27 lines (21 loc) · 1.68 KB
title layout tags
Docs - Optimizing on .NET
docs
docs
how to
build

Optimizing on .NET

Application optimization is ultimately handled by the RequireJS optimizer, r.js. This tool is somewhat complicated to use, so a Durandal-specific optimizer is provided, which generates the proper r.js configuration based on your project. The optimizer is located at app/durandal/amd/optimizer.exe. Here are the basic steps to optimize your app:

  1. Be sure that you have installed NodeJS. It is required by r.js currently.
  2. Navigate to app/durandal/amd
  3. Run optimizer.exe

The optimizer will walk the directory structure up to your App folder, then locate all HTML and JS files recursively underneath it, excluding those in the amd folder. It will then include all those files in your optimized build, making sure to use the text plugin for HTML files. The final optimized file will be output directly under your App folder and will be named main-built.js. To deploy, simply remove your RequireJS script reference from your HTML page and replace it with a reference to this self-contained file.

Note: If you are using the Durandal Starter Kit, then the Index.cshtml is already set up to reference the correct script configuration based on your server mode.

Note: When the Durandal optimizer runs r.js it configures it to replace RequireJS with Almond, a streamlined module loader which assumes an optimized build and is much smaller, since it doesn't need to handle dynamic module downloads. For more information, read this bit on using Durandal and Almond together.