2.0.0 • Published 6 years ago

lasso-dust v2.0.0

Weekly downloads
1
License
Apache License v2...
Repository
github
Last release
6 years ago

lasso-dust

Plugin for the Lasso.js to support compilation and transport of Dust template files. Templates are compiled using the dustc-commonjs compiler that produces a CommonJS module as output.

Usage

npm install lasso-dust --save
npm install view-engine --save
npm install view-engine-dust --save

Register the plugin when configuring the lasso. For example:

require('lasso').configure({
    "plugins": [
        ...
        "lasso-dust"
    ]
    ...
});

Required Dust templates will automatically be found via static code analysis as long as they are loaded using require.resolve(path) and rendered using code similar to the following (inside a CommonJS module):

require('view-engine').register('dust', require('view-engine-dust'));

// ...

// Template must be loaded using require.resolve!
var template = require('view-engine').load(require.resolve('./template.dust'));

template.render({
        name: 'Frank'
    },
    function(err, output) {
        console.log(output);
    });

To explicitly declare templates that may not be discovered via static code analysis of CommonJS modules, you can also choose to declare a Dust template dependency in an browser.json file.

{
    "dependencies": [
        "template.dust"
    ]
}

NOTE: No configuration is supported by this module.

Contributors

Contribute

Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.

License

Apache License v2.0

2.0.0

6 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago