Jekyll creates two instances just to boot, build and watch. #4858
Closed
Description
While debugging Jekyll Assets on Jekyll 3.1+ to figure out why our Jekyll::Assets::Env#used was constantly reset even though we cache the instance, check for the instance and only reinit on a new Jekyll, I noticed that Jekyll start's itself twice
jordon ~/development/envygeeks/envygeeks.io (master #) → rm -rf .asset-cache
jordon ~/development/envygeeks/envygeeks.io (master #) → rm -rf _site
jordon ~/development/envygeeks/envygeeks.io (master #) →bundle exec jekyll s -w --trace --verbose
Logging at level: debug
Configuration file: /home/jordon/development/envygeeks/envygeeks.io/_config.yml
The total number of Jekyll instances: 1
Creating a new instance of: Jekyll::Assets::Env
The old value of Sprockets:
Requiring: /home/jordon/development/envygeeks/envygeeks.io/_plugins/filters.rb
Requiring: kramdown
Source: /home/jordon/development/envygeeks/envygeeks.io
Destination: /home/jordon/development/envygeeks/envygeeks.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
The total number of Jekyll instances: 1
EntryFilter: excluded /vendor/cache
EntryFilter: excluded /vendor/bundle
Rendering: index.md
Pre-Render Hooks: index.md
Rendering Liquid: index.md
Rendering Markup: index.md
Requiring: kramdown
Rendering Layout: index.md
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/font-awesome/fontawesome-webfont.eot
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/font-awesome/fontawesome-webfont.woff2
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/font-awesome/fontawesome-webfont.woff
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/font-awesome/fontawesome-webfont.ttf
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/font-awesome/fontawesome-webfont.svg
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/roboto-slab.woff2
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/bundle.css
done in 3.581 seconds.
Requiring: jekyll-watch
The total number of Jekyll instances: 2
Creating a new instance of: Jekyll::Assets::Env
The old value of Sprockets:
Requiring: /home/jordon/development/envygeeks/envygeeks.io/_plugins/filters.rb
Requiring: kramdown
Watcher: Ignoring (?-mix:_config\.yml)
Watcher: Ignoring (?-mix:_site)
Watcher: Ignoring (?-mix:vendor)
Watcher: Ignoring (?-mix:\.bundle)
Watcher: Ignoring (?-mix:\.asset\-cache)
Auto-regeneration: enabled for '/home/jordon/development/envygeeks/envygeeks.io'
Logging at level: debug
Configuration file: /home/jordon/development/envygeeks/envygeeks.io/_config.yml
[2016-04-29 21:29:14] INFO WEBrick 1.3.1
[2016-04-29 21:29:14] INFO ruby 2.3.0 (2015-12-25) [x86_64-linux-gnu]
[2016-04-29 21:29:14] DEBUG WEBrick::HTTPServlet::FileHandler is mounted on /.
[2016-04-29 21:29:14] DEBUG unmount .
[2016-04-29 21:29:14] DEBUG Jekyll::Commands::Serve::Servlet is mounted on .
Server address: http://127.0.0.1:4000/
[2016-04-29 21:29:14] INFO WEBrick::HTTPServer#start: pid=25326 port=4000
Server running... press ctrl-c to stop.
Regenerating: 1 file(s) changed at 2016-04-29 21:30:51 The total number of Jekyll instances: 2
EntryFilter: excluded /vendor/cache
EntryFilter: excluded /vendor/bundle
Rendering: index.md
Pre-Render Hooks: index.md
Rendering Liquid: index.md
Rendering Markup: index.md
Requiring: kramdown
Rendering Layout: index.md
Jekyll Assets: Writing /home/jordon/development/envygeeks/envygeeks.io/_site/assets/bundle.css
...done in 0.076060421 seconds.
Jekyll Watch should take the current instance of Jekyll, not create it's own instance, this way there is an efficiency in how people can program and cache stuff on Jekyll. Ultimately this doesn't matter to us as we worked around it easily, Jekyll has two instances in memory just to watch and build from the same command.