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

Events out of order #1062

Closed
danguilherme opened this issue Apr 15, 2017 · 1 comment
Closed

Events out of order #1062

danguilherme opened this issue Apr 15, 2017 · 1 comment

Comments

@danguilherme
Copy link

I'm writing a DocPad plugin, and I'm finding some trouble in the order of the events. They do not seem to work as the DocPad website states:

Available Events
Sorted by their flow of execution within DocPad

  • extendTemplateData
  • extendCollections
  • ...

In my plugin, if I put simple console.logs in these functions, the output is:

> extendCollections called
> extendTemplateData called

It gets worse if I declare the collections property in my DocPad configuration:

docpadConfig:
    collections:
        posts:
            console.log('collections.posts called');
            // I'd like to access the collection created by my plugin

It is called before any of the above events, so the collection I created on extendCollections isn't available. Am I doing something wrong? Shouldn't I have access to collections "extended" in extendCollections?

@balupton
Copy link
Member

thanks for feedback!

seems the docs are incorrect:

docpad/src/lib/docpad.coffee

Lines 2442 to 2446 in e5e9846

postTasks.addTask 'extend collections', (complete) ->
docpad.extendCollections(complete)
postTasks.addTask 'fetch plugins templateData', (complete) ->
docpad.emitSerial('extendTemplateData', {templateData:docpad.pluginsTemplateData}, complete)

It is called before any of the above events, so the collection I created on extendCollections isn't available. Am I doing something wrong? Shouldn't I have access to collections "extended" in extendCollections?

extendCollections is for injecting new collections, populateCollections is for adding documents for them, there isn't currently something in between

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