A marko template loader for webpack
Switch branches/tags
greenkeeper/loader-utils-1.0.4 greenkeeper/loader-utils-1.1.0 greenkeeper/marko-4.0.0 greenkeeper/marko-4.0.1 greenkeeper/marko-4.1.0 greenkeeper/marko-4.1.1 greenkeeper/marko-4.1.2 greenkeeper/marko-4.1.3 greenkeeper/marko-4.2.0 greenkeeper/marko-4.2.1 greenkeeper/marko-4.2.2 greenkeeper/marko-4.2.3 greenkeeper/marko-4.2.4 greenkeeper/marko-4.2.5 greenkeeper/marko-4.3.0 greenkeeper/marko-4.3.1 greenkeeper/marko-4.4.0 greenkeeper/marko-4.4.1 greenkeeper/marko-4.4.2 greenkeeper/marko-4.4.3 greenkeeper/marko-4.4.4 greenkeeper/marko-4.4.5 greenkeeper/marko-4.4.6 greenkeeper/marko-4.4.7 greenkeeper/marko-4.4.8 greenkeeper/marko-4.4.9 greenkeeper/marko-4.4.10 greenkeeper/marko-4.4.11 greenkeeper/marko-4.4.12 greenkeeper/marko-4.4.13 greenkeeper/marko-4.4.14 greenkeeper/marko-4.4.15 greenkeeper/marko-4.4.16 greenkeeper/marko-4.4.17 greenkeeper/marko-4.4.18 greenkeeper/marko-4.4.19 greenkeeper/marko-4.4.20 greenkeeper/marko-4.4.21 greenkeeper/marko-4.4.22 greenkeeper/marko-4.4.23 greenkeeper/marko-4.4.24 greenkeeper/marko-4.4.25 greenkeeper/marko-4.4.26 greenkeeper/marko-4.4.27 greenkeeper/marko-4.4.28 greenkeeper/marko-4.5.0 greenkeeper/marko-4.5.1 greenkeeper/marko-4.5.2 greenkeeper/marko-4.5.3 greenkeeper/marko-4.5.4 greenkeeper/marko-4.5.5 greenkeeper/marko-4.5.6 greenkeeper/marko-4.6.0 greenkeeper/marko-4.7.0 greenkeeper/marko-4.7.1 greenkeeper/marko-4.7.2 greenkeeper/marko-4.7.3 greenkeeper/marko-4.7.4 greenkeeper/marko-4.7.5 greenkeeper/marko-4.8.0 greenkeeper/marko-4.9.0 greenkeeper/marko-4.9.1 greenkeeper/marko-4.9.2 greenkeeper/marko-4.9.3 greenkeeper/marko-4.9.4 greenkeeper/marko-4.9.5 greenkeeper/marko-4.9.6 greenkeeper/marko-4.9.7 greenkeeper/marko-4.10.0 greenkeeper/marko-4.10.1 greenkeeper/marko-4.11.0 greenkeeper/marko-4.11.1 greenkeeper/marko-4.11.2 greenkeeper/marko-4.11.3 greenkeeper/marko-4.11.4 greenkeeper/marko-4.11.5 greenkeeper/marko-4.12.0 greenkeeper/marko-4.12.1 greenkeeper/marko-4.12.2 greenkeeper/marko-4.12.3 greenkeeper/marko-4.12.4 greenkeeper/marko-4.12.5 greenkeeper/marko-4.13.0 greenkeeper/marko-4.13.1 greenkeeper/marko-4.13.2 greenkeeper/marko-4.13.3 greenkeeper/marko-4.13.4 greenkeeper/marko-4.13.5 greenkeeper/marko-4.13.6 greenkeeper/marko-4.13.7 greenkeeper/marko-4.13.8 greenkeeper/marko-4.13.9 greenkeeper/marko-4.13.10 greenkeeper/marko-4.13.11 greenkeeper/marko-4.13.12 greenkeeper/marko-4.13.13 greenkeeper/marko-4.14.0 greenkeeper/marko-4.14.1 greenkeeper/marko-4.14.2 greenkeeper/marko-4.14.3 greenkeeper/marko-4.14.4 greenkeeper/marko-4.14.5 greenkeeper/marko-4.14.6 greenkeeper/marko-4.14.7 greenkeeper/marko-pin-4.9.7 master
Nothing to show
Clone or download
Latest commit 0d8fb13 Apr 12, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Minor change to syntax Apr 12, 2018
test implement webpack@4.2.0 support, and tests for webpack 3.11.0 and 4.2.0 Mar 26, 2018
.gitignore Initial commit Sep 13, 2016
.jshintrc Initial commit Sep 13, 2016
LICENSE Initial commit Sep 13, 2016
README.md Automatically detect webpack target Aug 29, 2017
package.json 1.3.3 Apr 12, 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