-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: enable fileendings separated by more than one dot #1459
base: dev
Are you sure you want to change the base?
Conversation
@@ -129,8 +129,8 @@ const engine_handlebars = { | |||
* assume it's already present | |||
*/ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
const metaFileContent = fs.readFileSync( |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.js
andpackages/engine-twig-php/lib/engine_twig_php.js
to even also include.html.twig
besides.twig
packages/core/src/lib/object_factory.js
to check for a configured multi-dotted file extension and remove this form one from variablethis.fileName
whereas replace it inthis.fileExtension