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
The aim would be to allow function type options to be passed through metalsmith.json, so one is not forced to use the JS approach, say if for example we want to use the slug option of @metalsmith/permalinks: https://github.com/metalsmith/permalinks#custom-slug-function
ms.use(permalinks({slug(path){returnpath}})
There should be a way to refer to functions in another file in Metalsmith directory & its node_modules
we could think of something like:
The issue is what will the "marker" be. file://? function:// ? @.
Also, if something generic is used, like file://, name collision could occur easily, but it would also allow to construct a metalsmith.json from separate config files loaded into placeholders ( a bit like a lot of MVC frameworks allow to split config over multiple files, eg spring boot, laravel)
This feature will add some parsing overhead as it needs to deep-walk all plugin options and replace values matching the marker with their respective exports.
The text was updated successfully, but these errors were encountered:
webketje
changed the title
CLI: add mechanism to pass callbacks as plugin options through package.json
CLI: add mechanism to pass callbacks as plugin options through metalsmith.json
May 16, 2022
But the problem is it needs to be async to use dynamic import (not supported by JSON.parse reviver) and have a reference to the full keypath from root to be able to set the resolved import to target later. Example
The aim would be to allow function type options to be passed through
metalsmith.json
, so one is not forced to use the JS approach, say if for example we want to use theslug
option of@metalsmith/permalinks
: https://github.com/metalsmith/permalinks#custom-slug-functionThere should be a way to refer to functions in another file in Metalsmith directory & its node_modules
we could think of something like:
The issue is what will the "marker" be.
file://
?function://
?@
.Also, if something generic is used, like
file://
, name collision could occur easily, but it would also allow to construct a metalsmith.json from separate config files loaded into placeholders ( a bit like a lot of MVC frameworks allow to split config over multiple files, eg spring boot, laravel)This feature will add some parsing overhead as it needs to deep-walk all plugin options and replace values matching the marker with their respective exports.
The text was updated successfully, but these errors were encountered: