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

Block extension registration #1192

Closed
bhollis opened this Issue Mar 1, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@bhollis
Copy link
Member

bhollis commented Mar 1, 2014

I just noticed that it looks like in v4, extensions get registered like this:

require "middleman-core"
require "middleman-sprockets/extension"
Middleman::Sprockets.register

Here's the way it worked in v3:

require "middleman-core"
require "middleman-syntax/version"

::Middleman::Extensions.register(:syntax) do
  require "middleman-syntax/extension"
  ::Middleman::Syntax::SyntaxExtension
end

Two reasons I liked block mode:

  1. It preserves compatibility with existing extensions, so they won't all have to update.
  2. It makes it easier to prevent requiring everything the extension needs until the extension is actually activated. I really liked that pattern, since it would keep a lot of stuff from being brought in for extensions that aren't needed.

@tdreyno, what do you think? What are your goals with the changes to extension registration in v4?

@bhollis bhollis added the v4 label Mar 1, 2014

@tdreyno

This comment has been minimized.

Copy link
Member

tdreyno commented Mar 3, 2014

Whoops, didn't mean to break compatibility. The method still takes an optional name like :syntax, but doesn't execute the block.

I think I just thought it was a lot of misdirection to save some dependency requires and it only happens at boot so the perf hit isn't terribly important.

That said, this should remain compatible to let's go back.

@bhollis bhollis self-assigned this Mar 4, 2014

tdreyno added a commit that referenced this issue Mar 25, 2014

@tdreyno tdreyno closed this Mar 25, 2014

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