yarn
yarn watch
yarn build
module.exports = {
data: {
name: 'Awesome site'
},
models: {},
compiler: () => {/* HTML Compiler */}
}
module.exports = {
data: () => {
return {
name: 'Awesome website'
}
},
models: {},
compiler: () => {/* HTML Compiler */}
}
module.exports = {
data: fetch('https://jsonplaceholder.typicode.com/todos/1').then(response => response.json()),
models: {},
compiler: () => {/* HTML Compiler */}
}
Installation
yarn add handlebars
app.config.js
import Handlebars from 'handlebars'
module.exports = {
data: {},
models: {},
compiler: (source, data) => {
var template = Handlebars.compile(source);
return template(data)
}
}
app.config.js
module.exports = {
data: {},
models: {
'posts': {
template: 'posts.html',
transform: (data) => {
data.url = 'articles/' + stringToReadableURL(data.title) + '.html';
return data
}
}
},
compiler: () => {/* HTML Compiler */}
}