The most basic way to include a folder in your Origami site definition is with a path.
site.ori
{
// Expose everything in the src/assets folder as the `/stuff` route
stuff: src/assets
}
$ ls src/assets
favicon.ico main.css
$ ori Tree.paths site.ori
- stuff/favicon.ico
- stuff/main.css
$
Tree.paths lists all routes in the site.
If the files should appear in a branch with the same name as the folder, use just the folder path as a shorthand.
site.ori
{
// Expose everything in the src/assets folder as the `/assets` route
src/assets
}
$ ori Tree.paths site.ori
- assets/favicon.ico
- assets/main.css
$
Works like JS property shorthand
You can individually include each of a folder’s files with the three-dot spread operator.
site.ori
{
// Expose everything in the src/assets folder at the top level
...src/assets
}
$ ori Tree.paths site.ori
- favicon.ico
- main.css
$
Now the files are at the top level.
Built-in tree operations give you fine-grained control over what to include!
site.ori
{
// Expose just the stylesheets in src/assets
styles: Tree.mask(src/assets, Tree.globKeys({ "*.css": true }))
}
$ ori Tree.paths site.ori
- styles/main.css
$
Just the CSS files now.
Read more: Site definitions