Skip to content

Commit

Permalink
doc(template engine): examples of use calls
Browse files Browse the repository at this point in the history
  • Loading branch information
thepian committed Mar 23, 2015
1 parent 3009f49 commit 15b66ed
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/js/docs-setup.js
Expand Up @@ -309,7 +309,7 @@ NG_DOCS={
"type": "service",
"moduleName": "client",
"shortDescription": "This is for the module returned by require('socketstream').client.templateEngine.",
"keywords": "api built-in bundler callback cb client config default directories dirs engine engines enging entries error files function generate indicated instance making markup module object output passed receive render require returned service socketstream string template templateengine templates templating"
"keywords": "angular api built-in bundler callback cb client config custom custom-engine default directories dirs ember engine engines enging entries error files function generate indicated instance making markup module object output passed receive render require returned service socketstream ss string template templateengine templates templating"
},
{
"section": "api",
Expand Down
14 changes: 13 additions & 1 deletion docs/partials/api/client.templateEngine.templateEngine.html
Expand Up @@ -9,7 +9,19 @@ <h1><code ng:non-bindable="">templateEngine</code>
<div class="member method"><h2 id="methods">Methods</h2>
<ul class="methods"><li><h3 id="methods_use">use(name, dirs, config)</h3>
<div class="use"><div class="client-templateengine-page client-templateengine-templateengine-use-page"><p>Use a template engine for the &#39;dirs&#39; indicated (will use it on all &#39;/&#39; dirs within /client/templates by default)</p>
</div><h5 id="methods_use_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="client-templateengine-page client-templateengine-templateengine-use-page"><ul>
<p>To make templates in <code>/client/ember-view</code> available in Ember.</p>
<pre><code>ss.client.templateEngine.use(&#39;ember&#39;,&#39;./ember-view&#39;);
</code></pre><p>To make templates in <code>/client/angular-view</code> available in Angular.</p>
<pre><code>ss.client.templateEngine.use(&#39;angular&#39;,&#39;./angular-view&#39;);
</code></pre><p>To make templates in <code>/client/templates/angular-view</code> available in Angular.</p>
<pre><code>ss.client.templateEngine.use(&#39;angular&#39;,&#39;/angular-view&#39;);
</code></pre><p>To make templates anywhere in <code>/client</code> available in Angular.</p>
<pre><code>ss.client.templateEngine.use(&#39;angular&#39;,&#39;/&#39;);
</code></pre><p>To make templates anywhere in <code>/client</code> available using a custom engine.</p>
<pre><code>ss.client.templateEngine.use(require(&#39;custom-engine&#39;));
</code></pre><p>To make templates anywhere in <code>/client/custom</code> available using a custom engine.</p>
<pre><code>ss.client.templateEngine.use(require(&#39;custom-engine&#39;),&#39;./custom&#39;);
</code></pre></div><h5 id="methods_use_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="client-templateengine-page client-templateengine-templateengine-use-page"><ul>
<li>Built-in templating engine or function making the enging.</li>
</ul>
</div></td></tr><tr><td>dirs</td><td><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="client-templateengine-page client-templateengine-templateengine-use-page"><ul>
Expand Down
24 changes: 24 additions & 0 deletions lib/client/template_engine.js
Expand Up @@ -32,6 +32,30 @@ module.exports = function(ss,options) {
* @param {Object} config - Config passed to the template engine.
* @description
* Use a template engine for the 'dirs' indicated (will use it on all '/' dirs within /client/templates by default)
*
* To make templates in `/client/ember-view` available in Ember.
*
* ss.client.templateEngine.use('ember','./ember-view');
*
* To make templates in `/client/angular-view` available in Angular.
*
* ss.client.templateEngine.use('angular','./angular-view');
*
* To make templates in `/client/templates/angular-view` available in Angular.
*
* ss.client.templateEngine.use('angular','/angular-view');
*
* To make templates anywhere in `/client` available in Angular.
*
* ss.client.templateEngine.use('angular','/');
*
* To make templates anywhere in `/client` available using a custom engine.
*
* ss.client.templateEngine.use(require('custom-engine'));
*
* To make templates anywhere in `/client/custom` available using a custom engine.
*
* ss.client.templateEngine.use(require('custom-engine'),'./custom');
*/
use: function(nameOrModule, dirs, config) {
if (!dirs) {
Expand Down

0 comments on commit 15b66ed

Please sign in to comment.