Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

lasso-marko

2.5.0 • Public • Published

lasso-marko

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

Usage

npm install lasso-marko --save

Register the plugin when configuring the lasso. For example:

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

Enable cache for production:

require('lasso').configure({
    "plugins": [
        ...
        {
            "plugin": "lasso-marko",
            "config": {
                "useCache": true
            }
        }
    ]
    ...
});

Required Marko 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):

// Template must be loaded using require.resolve!
var template = require('marko').load(require.resolve('./template.marko'));
 
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 Marko template dependency in an browser.json file.

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

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

Install

npm i lasso-marko

DownloadsWeekly Downloads

3,313

Version

2.5.0

License

Apache-2.0

Unpacked Size

24.2 kB

Total Files

17

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar