A marko template loader for webpack
JavaScript HTML
Switch branches/tags
Clone or download
Latest commit 0d8fb13 Apr 13, 2018

README.md

marko-loader

A marko template loader for webpack.

Installation

Install required packages:

npm install marko --save
npm install marko-loader --save-dev

And then register the marko loader in your webpack configuration file:

webpack.config.js:

const options = {
    // ...
    module: {
        loaders: [
            { test: /\.marko$/, loader: 'marko-loader' }
        ]
    }
};

module.exports = options;

Usage

With this loader installed, you can then require ./template.marko files as shown below:

./template.marko:

<div>
    <h1>Hello ${data.name}!</h1>
</div>

./index.js:

var template = require('./template.marko')
var html = template.renderToString({ name: 'Frank' });

Compilation target

marko-loader will automatically detect your webpack target and output the appropriately compiled Marko code. If you wish to override this behaviour simply add the target field in the options for this loader.

Additional resources

License

MIT