Closed fvsch closed 4 years ago
we could solve this by adding a name
property to the returned object in the adapter like so:
name: '@frctl/twig',
we could also get the name automatically if the engine is registered via string, e.g. fractal.components.engine('@frctl/twig');
, but there's no way to get it when object is passed in.
and then do a conditional set in fractal core:
if (adapter.name) {
this._app.components.set('engine', adapter.name);
}
so this would need a change in core & in all the adapters as none of them can currently tell what the package name is.
alternatively we could also set the config value in the adapter class constructor (as app
is passed in to the constructor), so core changes would not be necessary:
this._app.components.set('engine', '@frctl/twig');
i feel like core should be responsible for updating the config value when the engine is registered, but since it's a oneliner to do it directly in the adapter, maybe that's the better way forward.
willing to fix all the adapters if we agree on the most correct solution.
@allmarkedup what do you think about this? how should we set the config value from the adapter?
Very minor "bug" here I guess. Using 1.0.0-beta.2 and @frctl/fractal 1.1.7, with this config:
Twig templates are working alright, but the
_config.components.engine
value is still set to"@frctl/handlebars"
:Instead if I use this config, the value will be correct: