BlueSpire/Durandal — pull request #191 by dotnetwise (2013-06-17 15:33:09+00:00)
Title: Modules, localization and more r.js options support

1. Added support for more options that are supported by r.js
2. All that were hardcoded are now options so they are configurable
```csharp
[Option('o', "output", DefaultValue = "main-built.js", HelpText="Specify the name of the output combined and minified built file. Relative to the application source folder (-s option)")]
public string OutputFileName { get; set; }

[Option("buildFile", DefaultValue = "app.build.js", HelpText="Specify where the json configuration for r.js will be saved within this folder")]
public string BuildFile { get; set; }

[Option("mainEntry", DefaultValue = "main.js", HelpText = "Specify the main entry point file")]
public string MainEntry { get; set; }

[Option("name", DefaultValue = "main", HelpText = "Specify the module name")]
public string ModuleName { get; set; }

[Option("preserveLicenseComments", DefaultValue = true, HelpText = "Specify false to remove the license comments")]
public bool? PreserveLicenseComments { get; set; }

[OptionList('r', "require", HelpText = "Default: main. Include extra requires separated by semicolon (;)", Separator = ';')]
public IList InsertRequire { get; set; }

[OptionList('x', "exclude", HelpText = "Exclude certain modules i.e. if they were built before", Separator = ';')]
public IList Excludes { get; set; }
```

3. `--config` can now be a javascript file, which is supported by r.js and you'll have intellisense and not get any errors while editing your config.js file
i.e.
```js
module.exports = {
....
}
```

4. `// comments` are now supported
JSON.net by default won't support them but we replace them to `/* block comments */` on every line

5. You can ignore certain files or folders with option `-i` / `--ingnore`
```csharp
[OptionList('i', "ignore", HelpText = "Ignore certain files or folders relative to the app path, separated by semicolon ;", Separator = ';')]
public IList Ignores { get; set; }
```

6. `--lang` option
```csharp
[Option("lang", Required = false, DefaultValue = "en", HelpText = "Specify the language to be replaced %LANG% paths on modules. You need to provide a custom configuration file first (-c) that has defined modules and we'll replace the %LANG% with this value in all the 'include' options of all the provided modules")]
public string Lang { get; set; }
```

In order to make use of `%LANG%` you'll need to
* provide `-lang en` or any other language
* provide `-config yourConfig.js` your start configuration
* define your `modules` in the config files i.e.

```javascript
modules: [{
name: "main",
include: [
"durandal/*.js", //*.js from durandal folder only
"main/**.js", //*.js from main folder and its sub-folders recursively
"text!views/%LANG%/**.html", //*.html from i.e. views/en/*.html and its sub-folders recursively
],
}, {
name: "account",
insertRequire: [
"main",
],
exclude: ["vendor", "main"],
"include": [
"text!gv/%LANG%/account/**.html",
"vm/account/**.js",
],
}],
```

The `%LANG%` will be replaced with `en` in the above, so you can run the same build file against multiple languages if your site happen to be multi-lingual with specific `.js` or `.html` files.

7.- Custom `build.txt` log file can be specified if you provide your own `--config` configuration.js file. In below example we'll be replacing `%LANG%` with the actual language file as well, so you can run multiple `optimization.exe` processes in parallel against your custom languages

```js
//Added by dotnetwise.
//Custom log file instead of build.txt
buildLog: "build.%LANG%.log",
````