Fractal template engine adapters
Work-in-progress template engine adapters for Fractal v2.
Overview
This repository contains a collection of template engine adapters for Fractal that can be used to render HTML output of component view files.
The currently available adapters are:
const fractal = require('@frctl/fractal');
const parser = fractal({
src: './path/to/components'
});
parser.addAdapter('nunjucks');
parser.parse(function(err, library) {
if (err) {
return console.log(err);
}
const view = library.findView('button', 'nunjucks');
library.renderView(view, {label: 'Click me!'}, function(err, html){
console.log(html);
});
});
Installation
The adapters in this repository are included with Fractal by default so do not need to be installed manually.
However, the underlying template engines do need to be installed in your project before the corresponding adapter can be used.
Nunjucks
npm i nunjucks --save
Handlebars
npm i handlebars --save
React
npm i react react-dom babel-register babel-preset-es2015 babel-preset-react --save
Requirements
Node >= v6.0 is required.