Skip to content

Pre/Post hooks  #85

Description

@svetozarstojkovic

Last week @starsinmypockets and I came across a weird behaviour while implementing 'ckan_pages' plugin.

  1. '/' endpoint was overwritten in the theme index.js file.
  2. in the plugin I tried to add a session variable that can be used in nunjucks template.

The problem was that the theme endpoint was executed before the plugin and there res.render function was called and we get an html page before variable from the plugin was set.

The proposal is to create prehooks and posthooks in .env file that will tell which plugins will be executed before and which will be executed after the theme.

By adding that we will have more control when opening some page.

Prehooks will be used for plugins that set variables that need to be used in nunjucks template.
Posthooks will be used for plugins that override some endpoints.

@anuveyatsu what do you think about this idea?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions