Jekyll `--incremental` flag and watch-mode staleness
0 reputation · 28 Jul 2025, 21:02 UTC
0 reputation · 28 Jul 2025, 21:02 UTC
Jekyll's --incremental flag is documented to accelerate repeated jekyll serve runs by skipping unchanged content during watch-mode rebuilds. However, the precise conditions under which stale content may persist without a full regeneration remain ambiguous, especially when multiple configuration files or plugin-injected assets are involved. This question addresses the boundary between incremental detection and guaranteed content freshness in a development workflow. The flag's interaction with file modification timestamps, directory watchers, and environment-specific _config.yml precedence is not explicitly defined in the official documentation, leaving developers to infer behavior through trial.
Does the --incremental flag respect file modification timestamps across all watched directories when --watch is active? How does the presence of a secondary _config.yml affect incremental rebuild decisions? What triggers a forced full rebuild despite the --incremental flag being set?
31775 reputation · 29 Jul 2025, 06:07 UTC
--incremental does not decide freshness purely from file modification timestamps. Jekyll maintains regeneration metadata (a dependency map between source files and the pages they affect) and regenerates only files whose content — or whose known dependencies — changed. Touching a file without changing its content generally does not trigger regeneration. A full rebuild is forced when the metadata cache is missing or deleted, when the process restarts without a readable cache, or when you run without --incremental. Editing config files is a known stale-output case: restart with a full build after changing them.
Confirmed behavior (well-established across Jekyll 3.x/4.x):
.jekyll-metadata or under .jekyll-cache/, depending on version) and uses it to skip unchanged documents on rebuild.--config _config.yml,_config_dev.yml are merged, later files taking precedence. However, the incremental tracker does not reliably treat config edits as a dependency of every page, so config changes can silently fail to propagate.Likely explanation for observed staleness: dependency tracking is best-effort. Dynamic Liquid includes, data-driven loops, and plugin- or generator-injected content often don't register dependencies, so their output stays stale until a full build. Separately, watch-mode staleness can come from the listen watcher missing events (symlinks, NFS, Docker bind mounts) — a different root cause than incremental logic.
_config.yml or any secondary config, stop the server and rebuild fully: rm -rf .jekyll-cache .jekyll-metadata
bundle exec jekyll serve --incremental--force_polling.--incremental for production builds.Run jekyll serve --incremental, edit one post, and check _site output timestamps — only that page and dependents (index, feeds) should update. Then edit a config value, observe whether it appears, delete the cache, and compare. Check jekyll --version, since cache location and incremental details differ between 3.x and 4.x.
One missing detail that would change this advice: your Jekyll version and whether the stale content comes from a plugin — if so, the fix is a full rebuild habit, not watcher tuning.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.