Getting Started Installation Templating Event handling Components Directives Examples API Reference

Installation

Install Monkberry with npm:

npm install monkberry --save

Webpack

Install monkberry-loader:

npm install monkberry-loader --save

Add monkberry-loader to webpack.config.js in loaders section:

loaders: [
  {test: /\.monk$/, loader: 'monkberry-loader'}
]

Browserify

Install monkberrify:

npm install monkberrify --save

Add to your browserify transforms. For example, if using gulp:

var monkberrify = require('monkberrify');

gulp.task('default', function() {
  gulp.src('app.js')
    .pipe(browserify({
      transform: [monkberrify]
    }))
    .pipe(gulp.dest('.'));
});

CLI

Install monkberry globally:

npm install monkberry -g

  Usage: monkberry [options] <file ...>

  Options:

    -h, --help           output usage information
    -o, --output [file]  output file name, if not specified will write to stdout.
    -s, --source-map     generate source map.
    --as-module          compile as module.
    --draw-ast           draw ast tree of file.
    

Example:

monkberry views/*.monk --source-map --output view.js

Now include it in your page with monkberry.js:

<script src="monkberry.js"></script>
<script src="view.js"></script>

CDN

You can use Monkberry from CDN:

<script src="https://cdn.jsdelivr.net/monkberry/latest/monkberry.js"></script>

Note that you still need to precompile your views to use it.

Other versions available on jsDelivr.com CDN.

Standalone

If you only want to play with Monkberry and do not need to install it, you can use monkberry-standalone. This package includes Monkberry runtime and compiler.

You can also play with Monkberry in this fiddle.

Next →