Skip to content
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

How to replace a default engine? #157

Closed
fserb opened this issue Dec 30, 2021 · 2 comments
Closed

How to replace a default engine? #157

fserb opened this issue Dec 30, 2021 · 2 comments

Comments

@fserb
Copy link
Contributor

fserb commented Dec 30, 2021

I have a plugin with:

site.loadPages([".md"], textLoader, new MyEngine());

With the new code this breaks, because Engines.engine ends up like:

Extensions {
  default: undefined,
  entries: [
    [ ".tmpl.ts", ModuleEngine { helpers: [Object] } ],
    [ ".tmpl.js", ModuleEngine { helpers: [Object] } ],
    [ ".md", MarkdownEngine { engine: [Object] } ],
    [
      ".njk",
      NunjucksEngine { env: [Object], cache: [Map], ... }
    ],
    [ ".md", MyEngine {} ]
  ]

and Engines.engine.search() returns the first entry. Extensions doesn't seem to worry about duplicates. Ideas?

@oscarotero
Copy link
Member

Mmm. The Extensions class should replace existing values instead of duplicate them.
Here https://github.com/lumeland/lume/blob/master/core/extensions.ts#L14 the function should remove the existing value before adding the new one.
Feel free to createa PR or I will fix it (I cannot right now).

@oscarotero
Copy link
Member

I just released a new version with the duplicated extensions bugfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants