You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have a bunch of .cook files in a recipes folder. I'd like to render these as HTML with a layout, but also serve these raw .cook files in the built site.
It's the same scenario as wanting to keep the source .md files in a blog and serve along side built .html files, or keep raw .json files and serve as a JSON API.
I have a hard time finding my way around the docs to find an elegant solution for this.
What I landed on now:
// _config.tsimport{copy,expandGlob}from'std/fs/mod.ts';constSRC='src';constDEST='build';constsite=lume({src: SRC,dest: DEST,});site.data('layout','layouts/reci.njk','/recipes')// Makes src/recipes/*.cook → build/recipes/*/index.html.loadPages(['.cook'],async(path)=>{consttext=awaitDeno.readTextFile(path);returnparseToRecipe(text);// irrelevant})// Makes src/recipes/*.cook → build/recipes/*.cook.addEventListener('afterBuild',async()=>{// Fiddly, since we don't want to overwrite the existing build/recipes directory from aboveforawait(constentryofexpandGlob(`./src/recipes/*.cook`)){awaitcopy(entry.path,`./${DEST}/recipes/${entry.name}`);}})
I've tried various combinations of:
Site.copy(): this would overwrite the built build/recipes dir.
Note: you can't use the same extension to generate pages and assets, so a way to have support for both is adding a sub-extension (like .page) for pages
Is my solution above the best one so far?
How often does it reproduce? Is there a required condition?
Version
2.1.3
Platform
macOS
What steps will reproduce the bug?
Let's say I have a bunch of
.cook
files in arecipes
folder. I'd like to render these as HTML with a layout, but also serve these raw.cook
files in the built site.It's the same scenario as wanting to keep the source
.md
files in a blog and serve along side built.html
files, or keep raw.json
files and serve as a JSON API.I have a hard time finding my way around the docs to find an elegant solution for this.
What I landed on now:
I've tried various combinations of:
Site.copy()
: this would overwrite the builtbuild/recipes
dir.Site.loadAssets()
.Site.loadData()
.I've read https://lume.land/docs/core/loaders top to bottom. The key paragraph for my issue is:
Is my solution above the best one so far?
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
Additional information
Related as input to:
The text was updated successfully, but these errors were encountered: