Install Monkberry with npm:
npm install monkberry --save
Install monkberry-loader:
npm install monkberry-loader --save
Add monkberry-loader to webpack.config.js in loaders section:
loaders: [
{test: /\.monk$/, loader: 'monkberry-loader'}
]
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('.'));
});
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>
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.
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.