JSPM

view-engine-marko

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q27590F
  • License Apache License v2.0

Marko view engine

Package Exports

  • view-engine-marko

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (view-engine-marko) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

view-engine-marko

Marko view engine

Installation

npm install view-engine-marko --save

Usage

Enable the Marko view engine:

require('view-engine').configure({
    engines: {
        'view-engine-marko': {
            extensions: ['marko']
        }
    }
})

The Marko view engine is now ready to be used elsewhere in your code:

var template = require('view-engine').load('hello.marko');

// Callback-style
template.render({ name: 'John'}, function(err, data) {
    if (err) {
        console.log('Failed to render: ' + err);
        return;
    }

    console.log('Output: ' + data);
});

// Streaming-style
var out = require('fs').createOutputStream('hello.out', {encoding: 'utf8'});
template.stream({ name: 'John'}).pipe(out);

// Render to an existing render context
template.render({ name: 'John'}, context);

See the documentation for the view engine module for more information.