Skip to content

Render a choo app in a static website and give choo the hand in front

Notifications You must be signed in to change notification settings

Kilix/metalsmith-choo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metalsmith-choo

Travis branch npm

Wiki

You can find a tutorial here

Install

npm install metalsmith-choo

Usage

// In yout metalsmith 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."))

In your choo app require the wrapper.

  const wrapper = require('metalsmith-choo/lib/chooWrap')

and then replace the app.start() by :

  module.exports = wrapper(app)

Informations

The metalsmith metadata will be automaticly added to your app state under the key 'metadata'. The content of the file from metalsmith will be added to your app state under the key you specified in your frontmatter.

markdown example file:

---
namespace: home
// eventually more key, they will be add to your state
title: Homepage
---

# Hello content

Roadmap

  • handle dynamic routing with metalsmith-collection ?
  • get route from choo app (avoid the user to explicitly tell the routes to render)

Tests

npm run test

Contribute

Make an issue or a PR :) To commit just use npm run commit

About

Render a choo app in a static website and give choo the hand in front

Resources

Stars

Watchers

Forks

Packages

No packages published