awoo-layouts
reusable html layouts for awoo
Features
- Powerful templating system
- Templates are just JavaScript functions!
- Ability to perform templating on a subset of files
Installation
# you will need frontmatter support: npm install awoo-matternpm install awoo-layouts
Usage example
const awoo = const matter = const layouts = // a layout is just a js function that returns a string of// html! it takes the current file and also the total set// of filesconst layout = `<h1> </h1>` // enter our main function:// the main function should be an async function so that// it automatically returns a promise
Filters
By default, layouts
only operates on HTML files (files that end with .html
).
This can be changed easily by using a custom filter. A filter is a function that
takes a file and returns a boolean that describes whether that file should have
layouts
enabled or not. A custom filter can look like this:
{ return filepath}
This filter only matches for Markdown files. If you wanted to match on multiple file extensions at the same time, you could do something like this:
const fileExtension = filepath { return 'md' 'html'}
To use the filter, just pass it into the plugin options:
Maintainers
- Olivia Hugger <olivia@fastmail.com>
License
MIT (see LICENSE document)