datocms / middleman-dato

A Middleman extension to integrate your website with DatoCMS
https://docs.datocms.com/middleman/overview.html
MIT License
24 stars 7 forks source link

Avoid evaluating @initialize twice #11

Closed schonfeld closed 6 years ago

schonfeld commented 6 years ago

Turns out that Middleman loads every extension twice -- once with app.mode === :config, and another with app.mode === :server. This makes the current extension release do everything twice, inflating startup time by 2x.

For reference, see: 1) https://github.com/middleman/middleman/issues/1952#issuecomment-348105969 2) https://github.com/middleman/middleman/blob/3d288197f8310e94e7e785b6dbb96d36b445812b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb#L13

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.5%) to 43.478% when pulling 71dfaad07c3f72a9dbf7bde435718b48ad5d0bdc on schonfeld:dont-init-twice into c7e3703bc0fa09be81ef8df2cc6c80a65748e60c on datocms:master.

stefanoverna commented 6 years ago

Awesome, released in v0.8.2