-
Notifications
You must be signed in to change notification settings - Fork 0
How to: metalsmith
William edited this page Oct 4, 2016
·
2 revisions
First, you need to install the package :
npm install metalsmith-choo
Then in your metalsmith script file :
const metalsmith = require('metalsmith')
const markdown = require('metalsmith-markdown')
const choo = require('../lib/')
metalsmith(__dirname)
.source('src')
.destination('dist')
.use(markdown())
.use(choo({
entry: './choo/index.js'
, routes: ['/', '/about']
, bundle: '/bundle.js'
}))
.build(err => err ? console.error(err) : console.log("builded."))
You need to provide a few params :
- entry : the entry point of your choo app.
- routes: An array of the route you want to render in static from your choo app.
- bundle: the bundled javascript file of your choo app.
- We think it's better to let you handle the bundling. So you can do what you want in and on it :)
Only one parameter is obligatory, the namespace. The namespace key represent the name of the object representing this view in your choo app state.
For example :
---
namespace: home
---
# Content
Your choo app state will contains :
state = {
home: {
namespace: 'home',
contents: '<h1>Content</h1>'
}
}