Add `:after_init` hook & add `Site#config=` to make resetting config easy #4703

Merged
merged 2 commits into from Mar 25, 2016

Conversation

Projects
None yet
3 participants
@parkr
Member

parkr commented Mar 23, 2016

@benbalter and I were working through github/pages-gem#209
and realized that it'd be way nicer to have a one-time hook which could run after initialization
but before generators/converters/etc are initialized for the site. It would also be nice to have
a "safe" way to set @config knowing that it'd fan out properly.

This PR adds :after_init to the list of :site hooks and adds Site#config= to make all that much easier.

/cc @jekyll/stability @jekyll/ecosystem

parkr added some commits Mar 23, 2016

@parkr parkr added this to the 3.2 milestone Mar 23, 2016

@parkr parkr added the enhancement label Mar 23, 2016

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Mar 25, 2016

Contributor

I ❤️ this but I have to ask, what is the difference between this and :after_reset semantically since they're both technically the same as far as usage goes (all our current plugins everywhere tap into :after_reset for the same purpose.)

That might be a debate for another day though.
:shipit:

Contributor

envygeeks commented Mar 25, 2016

I ❤️ this but I have to ask, what is the difference between this and :after_reset semantically since they're both technically the same as far as usage goes (all our current plugins everywhere tap into :after_reset for the same purpose.)

That might be a debate for another day though.
:shipit:

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Mar 25, 2016

Member

what is the difference between this and :after_reset semantically

This plugin happens once per Jekyll process, whereas :after_reset happens for every single regeneration. :after_init happens before the call to setup and reset, which mean it can affect the setup process (affecting list of generators and converters).

Member

parkr commented Mar 25, 2016

what is the difference between this and :after_reset semantically

This plugin happens once per Jekyll process, whereas :after_reset happens for every single regeneration. :after_init happens before the call to setup and reset, which mean it can affect the setup process (affecting list of generators and converters).

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Mar 25, 2016

Member

I want this for #4595.

@jekyllbot: merge +minor

Member

parkr commented Mar 25, 2016

I want this for #4595.

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit afa89d6 into master Mar 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jekyllbot jekyllbot deleted the after_init_hook branch Mar 25, 2016

jekyllbot added a commit that referenced this pull request Mar 25, 2016

parkr added a commit that referenced this pull request Mar 26, 2016

Merge remote-tracking branch 'origin/master' into themes
* origin/master: (65 commits)
  Update history to reflect merge of #4703 [ci skip]
  Update history to reflect merge of #4712 [ci skip]
  Highlight the test code
  Update history to reflect merge of #4640 [ci skip]
  readded "env=prod"-condition
  Update history to reflect merge of #3849 [ci skip]
  Update history to reflect merge of #4624 [ci skip]
  Update history to reflect merge of #4704 [ci skip]
  Update history to reflect merge of #4706 [ci skip]
  Checks for link file extension in tests
  Updating assets documentation
  Fix test teardown for cleaner.
  Update history to reflect merge of #4542 [ci skip]
  Add explanation of site variables in the example _config.yml
  Use double quotes in the gemfile
  Add test for creation of Gemfile by 'jekyll new'
  Add comment about github-pages
  Update history to reflect merge of #4533 [ci skip]
  Ensure Rouge closes its div/figure properly after highlighting ends.
  Add Site#config= which can be used to set the config
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment