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

[RFC] Refactor Eleventy.js to extend eventEmitter #406

Closed
chrisdmacrae opened this issue Feb 10, 2019 · 6 comments
Closed

[RFC] Refactor Eleventy.js to extend eventEmitter #406

chrisdmacrae opened this issue Feb 10, 2019 · 6 comments
Labels
enhancement needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.

Comments

@chrisdmacrae
Copy link
Contributor

Currently Eleventy.js is just a standard JavaScript class with methods.

This makes it very hard to expose Eleventy's lifecycle to end-users.

Refactoring Eleventy.js to extend EventEmitter will allow you to easily add lifecycle hooks to the Eleventy pipeline, and they could be exposed through .eleventy.js.

This would also afford the same functionality as Jekyll hooks.

@kleinfreund
Copy link
Contributor

I’d like to see some built-in hooks to be available, in particular one for accessing documents (especially Markdown) before they’re and after they’ve been transformed to HTML. I haven’t wrapped my head around this completely, but I can imagine there being use cases where you want to access unprocessed Markdown or the resulting HTML in transforms. Maybe we should have pre-templating and post-templating transforms?

@chrisdmacrae
Copy link
Contributor Author

@kleinfruend I'm building this feature.

What kind of hooks would you like to see?

@dweidner
Copy link

I am exploring ways to rewrite relative image urls in my markdown files. My first attempt intersepts the image renderer in the markdown library. That somehow works, but I do not have access to the front-matter of the corresponding template, which makes the solution a lot less flexible as it is difficult to determine the output path of the page (somehow related to #379). Hooks could help here and would allow plugins to rewrite (relative) image urls in the markdown content before they are passed to the actual parser/library.

@zachleat
Copy link
Member

zachleat commented Mar 8, 2019

Programmatic API related issues: #136

@zachleat zachleat added the needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved. label Mar 8, 2019
@zachleat
Copy link
Member

zachleat commented Mar 8, 2019

This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open.

View the enhancement backlog here. Don’t forget to upvote the top comment with 👍!

@zachleat zachleat closed this as completed Mar 8, 2019
@chrisdmacrae
Copy link
Contributor Author

@zachleat the user config already exposes an eventemitter. So really, it just needs to be implemented at lifecycle events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs-votes A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.
Projects
None yet
Development

No branches or pull requests

4 participants