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

Better Plugins: Hooks #1414

Closed
parkr opened this issue Aug 12, 2013 · 11 comments
Closed

Better Plugins: Hooks #1414

parkr opened this issue Aug 12, 2013 · 11 comments
Milestone

Comments

@parkr
Copy link
Member

parkr commented Aug 12, 2013

One of the sticking points for plugins is all the monkey-patching craziness necessary to do even the simplest of actions.

One idea I'd like to toss around is this idea of hooks. In a similar manner to rails, it would be easy to call methods before and after various actions. I'd propose the following:

  • Site
    • before_process
    • after_process
    • before_read
    • after_read
    • before_write
    • after_write
  • Post/Page
    • before_render
    • after_render
    • before_write
    • after_write

What is the general consensus around hooks?

//cc @mattr- @benbalter @qrush @mojombo

@benbalter
Copy link
Contributor

🆒 Great idea. I'm all sorts of for this.

@mattr-
Copy link
Member

mattr- commented Aug 14, 2013

🆒 👍 🎉

On Mon, Aug 12, 2013 at 7:29 AM, Ben Balter notifications@github.comwrote:

[image: 🆒] Great idea. I'm all sorts of for this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1414#issuecomment-22489627
.

@kevinSuttle
Copy link

Like post-receive hooks? That's a great idea!

@parkr
Copy link
Member Author

parkr commented Sep 4, 2013

Conceptually, yes! Upon running Jekyll with plugins, plugins could specify a block or something to execute right before or after something happens.

@kevinSuttle
Copy link

Where would those live ideally? At some API endpoint?

@parkr
Copy link
Member Author

parkr commented Sep 4, 2013

It'd besomething like Jekyll::Post.after_render and you'd provide a block or class that is executed. Or after_render would be an array so you could control the order.

@0xcaff
Copy link
Contributor

0xcaff commented Apr 17, 2014

+1

@troyswanson
Copy link
Member

I think the only thing that's worrisome here is the order in which the plugins are allowed access to the content.

We've had this trouble with other CMSs: plugin 🅱️ screws up something plugin 🅰️ changed. If people are judicious in their use of plugins and they limit their scope, this wouldn't be much of a problem and collision would be minimal. In practice, it might cause headaches for some.

All of that said, we should totally still do this, since it offers a very elegant approach to content manipulation.

@bitboxer
Copy link

The order is problematic, yes, but it's way better than the problems with the plugin order in the current monkey patching approach.

@troyswanson
Copy link
Member

Damn straight. 👍

@parkr
Copy link
Member Author

parkr commented Jul 31, 2014

In the works, closing this.

@parkr parkr closed this as completed Jul 31, 2014
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants