diff --git a/docs/_docs/configuration/options.md b/docs/_docs/configuration/options.md index 6bd23f6b3d3..40a507ade14 100644 --- a/docs/_docs/configuration/options.md +++ b/docs/_docs/configuration/options.md @@ -43,13 +43,35 @@ class="flag">flags (specified on the command-line) that control them.

Safe

-

Disable custom plugins, and ignore symbolic links.

+

+ Disable custom plugins, caching to disk + and ignore symbolic links. +

safe: BOOL

--safe

+ + +

+ Disable Disk Cache + 4.1.0 +

+

+ Disable caching of content to disk in order to skip creating a + .jekyll-cache or similar directory at the source + to avoid interference with virtual environments and third-party + directory watchers. + Caching to disk is always disabled in safe mode. +

+ + +

disable_disk_cache: BOOL

+

--disable-disk-cache

+ +

Exclude

diff --git a/features/cache.feature b/features/cache.feature index f6f62af11dd..156b35ca453 100644 --- a/features/cache.feature +++ b/features/cache.feature @@ -35,3 +35,12 @@ Feature: Cache But the .jekyll-cache directory should not exist And the _site directory should exist And I should see "

Hello World

" in "_site/index.html" + + Scenario: Disabling disk usage in non-safe mode + Given I have an "index.md" page that contains "{{ site.title }}" + And I have a configuration file with "title" set to "Hello World" + When I run jekyll build --disable-disk-cache + Then I should get a zero exit status + And the _site directory should exist + And I should see "

Hello World

" in "_site/index.html" + But the .jekyll-cache directory should not exist diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 68bc8cbe250..be8890e72de 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -67,6 +67,8 @@ def add_build_options(cmd) cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder" cmd.option "unpublished", "--unpublished", "Render posts that were marked as unpublished" + cmd.option "disable_disk_cache", "--disable-disk-cache", + "Disable caching to disk in non-safe mode" cmd.option "quiet", "-q", "--quiet", "Silence output." cmd.option "verbose", "-V", "--verbose", "Print verbose output." cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild." diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 8aca2d655a0..281c2fe592c 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -470,7 +470,7 @@ def site_cleaner # Disable Marshaling cache to disk in Safe Mode def configure_cache Jekyll::Cache.cache_dir = in_source_dir(config["cache_dir"], "Jekyll/Cache") - Jekyll::Cache.disable_disk_cache! if safe + Jekyll::Cache.disable_disk_cache! if safe || config["disable_disk_cache"] end def configure_plugins