techpines/asset-rack — pull request #107 by bryanchriswhite (2013-11-01 05:44:56+00:00)
Title: Angular templates asset

### Synopsis:
This will allow the directory in which your angular templates live to contain jade and/or html and will compile (in the case of jade) and put them in the $templateCache.

This does work with the `@rack.assets` object if you have multiple assets and are using `assets.url(...)` in your jade templates.

Need to add the example to the readme but the only notable bit is the need for a `root` option when using the angular-templates asset with jade. The value of the `root` option is the path (dirname) you will be using in your angular routing configuration or directives to reference the template file.

### Example:
This example will compile html and jade documents located on the filesystem in the `__dirname + '../widget/app/views'` directory, and embed them in JS file served by the server at `'/js/widget/templates.js'`.

#### Server
In your projects `assets.js`:
```
...
new rack.AngularTemplatesAsset({
url: '/js/widget/templates.js',
dirname: __dirname + '../widget/app/views',
root: '/widget/views'
}),
...
```

#### Client
In an angular route config:
```
...
$routeProvider.when('/image/:id', {
templateUrl: '/widget/views/image.html',
controller: 'MainCtrl'
})
...
```