Module: util/Template

This module uses underscore's template generation with an input from the html files in the project_root/views directory. It outputs a templated file (stringified version of the html) that you can use as a template to your views.

Author:
  • Serge Babayan
Source:

Requires

  • module:fs
  • module:underscore

Methods


<inner> Template(template_name)

Parameters:
Name Type Description
template_name string

The name of the html file you'd like to use as the template for your view. If its in the root of the views folder, just put in the file name. If its under a directory, include the directory name (eg. "subdirectory/MyHTMLFILE.html")

Source:
Returns:

A stringified version of the html that the view can use as its template.

Type
Object
Example

Usage of the Template class in a view

var Template=require('./util/Template');
return Template('my_html_file_name_in_views.html');
//Use the output from this ^^ as your views template.