Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steverandy/metalsmith-marko
Metalsmith plugin to render files with Marko templates
https://github.com/steverandy/metalsmith-marko
marko metalsmith metalsmith-plugin template
Last synced: 8 days ago
JSON representation
Metalsmith plugin to render files with Marko templates
- Host: GitHub
- URL: https://github.com/steverandy/metalsmith-marko
- Owner: steverandy
- License: mit
- Created: 2017-01-22T02:41:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-04T03:24:34.000Z (almost 8 years ago)
- Last Synced: 2024-12-14T14:15:29.229Z (11 days ago)
- Topics: marko, metalsmith, metalsmith-plugin, template
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# metalsmith-marko
A Metalsmith plugin to render files with [Marko](http://markojs.com/) templates.
It supports rendering source files with templates and layouts. By default it looks for layout files in `layouts` directory. You need to set the `layout` in source file frontmatter section in order to render it in a layout. Optionally, you can set `defaultLayout` in plugin options.
## Installation
```
$ npm install metalsmith-marko
```## Usage
### Without Options
```javascript
let marko = require("metalsmith-marko")metalsmith.use(marko())
```### With Options
```javascript
let marko = require("metalsmith-marko")metalsmith.use(marko({
layoutsDirectory: "layouts",
defaultLayout: "default.html",
pattern: ["**/*.marko", "**/*.html"],
compilerOptions: {
writeToDisk: false,
preserveWhitespace: true
}
}))
```### Default Options
```javascript
layoutsDirectory: "layouts",
pattern: ["**/*.marko"],
compilerOptions: {
writeToDisk: false,
preserveWhitespace: true
}
```### Templates
`layouts/default.html.marko`
```html
${data.title}
$!{data.contents}
```
`pages/index.html.marko`
```html
Heading
${page.title}```
## License
[MIT License](./LICENSE)