refactor: enable fileendings separated by more than one dot#1459
refactor: enable fileendings separated by more than one dot#1459
Conversation
| spawnMeta: function (config) { | ||
| this.spawnFile(config, '_head.hbs'); | ||
| this.spawnFile(config, '_foot.hbs'); | ||
| this.spawnFile(config, '_head.' + config.patternExtension); |
There was a problem hiding this comment.
This could be dangerous.
When pattern lab discovers multiple pattern engines, it will try to spawn the file found in the engine's folder located under _meta/head...
In that case, the file will not be found, and an error will be thrown here
You can either catch the error and ignore it, or you revert it to its former state.
Another issue could be, that by chance the file will be taken, but the output for the twig file will be overwritten by the content of the hbs file. In that case, it could lead to an error when serving pattern lab because it has a different rendering engine.
There was a problem hiding this comment.
I would rather look into the engineFileExtensions and when the config.patternExtension is included there, output the required file. (In that case, we need to read the file we deliver with the engine from the _meta folder and spawn it as the configured extension in config.patternExtension.
Closes #1030
Summary of changes:
packages/engine-twig/lib/engine_twig.jsandpackages/engine-twig-php/lib/engine_twig_php.jsto even also include.html.twigbesides.twigpackages/core/src/lib/object_factory.jsto check for a configured multi-dotted file extension and remove this form one from variablethis.fileNamewhereas replace it inthis.fileExtension