Edit this topic

Dust view engine

: shell

: view-engine

: dust-view-engine

: /modules/core/ui/services/dust-view-engine.js

: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/ui/services/dust-view-engine.js

Globals

CodeViewEngine()

A view engine using Dust templates. http://akdubya.github.io/dustjs/ https://github.com/linkedin/dustjs/wiki/Dust-Tutorial

The view engine exposes by default the standard helpers: https://github.com/linkedin/dustjs-helpers

Helpers

T - Makes the enclosed string localizable.

{@t}Text to localize{/t}

Shape

It adds a 'shape' helper that enables the rendering of DecentCMS shapes. The shape helper takes a 'shape' parameter that should point to the shape object to render. Optional parameters are tag and class.

{@shape shape=footer tag="footer" class="main-footer"/}

Style

Registers a style sheet. Use the non-minimized name, without extension, as the name parameter.

{@style name="style"/}

Styles

Renders the list of registered styles.

{@styles/}

Script

Registers a script. Use the non-minimized name, without extension, as the name parameter.

{@script name="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"/}

Scripts

Renders the list of registered scripts.

{@scripts/}

Meta

Registers a meta tag. name: the name of the tag value: the value of the tag (rendered as the content attribute) Additional attributes will be rendered as-is.

{@meta name="generator" value="DecentCMS"/}

Metas

Renders registered meta tags.

{@metas/}

load(templatePath, done)function

Loads the rendering function from the provided path.

CodeViewEngine()

A view engine using Dust templates. http://akdubya.github.io/dustjs/ https://github.com/linkedin/dustjs/wiki/Dust-Tutorial

The view engine exposes by default the standard helpers: https://github.com/linkedin/dustjs-helpers

Helpers

T - Makes the enclosed string localizable.

{@t}Text to localize{/t}

Shape

It adds a 'shape' helper that enables the rendering of DecentCMS shapes. The shape helper takes a 'shape' parameter that should point to the shape object to render. Optional parameters are tag and class.

{@shape shape=footer tag="footer" class="main-footer"/}

Style

Registers a style sheet. Use the non-minimized name, without extension, as the name parameter.

{@style name="style"/}

Styles

Renders the list of registered styles.

{@styles/}

Script

Registers a script. Use the non-minimized name, without extension, as the name parameter.

{@script name="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"/}

Scripts

Renders the list of registered scripts.

{@scripts/}

Meta

Registers a meta tag. name: the name of the tag value: the value of the tag (rendered as the content attribute) Additional attributes will be rendered as-is.

{@meta name="generator" value="DecentCMS"/}

Metas

Renders registered meta tags.

{@metas/}

load(templatePath, done) ⇒ function

Loads the rendering function from the provided path.

Returns: function - The template function.

Param Type Description
templatePath string The path to the .dust file.
done function The callback function to call when the template is loaded.