A marko template loader for webpack.
Install required packages:
npm install marko --save
npm install marko-loader --save
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;
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' });
- Sample app: github.com/marko-js-samples/marko-webpack
MIT