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

Run hooks in priority order. #5157

Merged
merged 1 commit into from Sep 28, 2016

Commits on Aug 7, 2016

  1. Run hooks in priority order.

    Low priority hooks are being run before higher priority hooks. This is easy to
    demonstrate with the following plugin:
    
        1.upto(10).each do |n|
          Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:low] do
            puts "Low #{n}"
          end
          Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:normal] do
            puts "Normal #{n}"
          end
          Jekyll::Hooks.register :site, :after_reset, priority: Jekyll::Hooks::PRIORITY_MAP[:high] do
            puts "High #{n}"
          end
        end
    
    Sorting by the negative of the priority and then by the order the hook was
    added does the right thing.
    stevecheckoway committed Aug 7, 2016
    Copy the full SHA
    6167c09 View commit details
    Browse the repository at this point in the history