1.1.0 • Published 6 years ago

@rill/marko v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Universal Marko rendering middleware for Rill.

It is recommended to combine this middleware with @rill/page as seen below to facilitate full page isomorphic rendering with Marko.

Installation

npm install @rill/marko

Example

import Rill from 'rill'
import page from '@rill/page'
import render from '@rill/marko'

// Create a rill app.
const app = Rill()

// Setup the document template.
app.get(page
  .html({ lang: 'en' })
  .meta({ charset: 'utf8' })
  .title('My Marko App')
  .meta({ name: 'author', content: 'Dylan Piercey' })
  .meta({ name: 'descripton', content: 'Universal JS is awesome' })
  .link({ rel: 'stylesheet', href: 'index.css' })
  .script({ src: 'index.js', async: true })
)

// Set locals in middleware. (access in marko with out.global)
app.use(({ locals }), next)=> {
	locals.title = '@rill/marko'
	return next()
})

// Render a Marko template.
const HomeTemplate = require('./home.marko')
app.get('/home', render(HomeTemplate, {
  message: 'world'
}))

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago