Allow disabling import of theme configuration (#8131)
Merge pull request 8131
This commit is contained in:
parent
1f39f7a96e
commit
ed11d2149e
|
@ -72,6 +72,24 @@ class="flag">flags</code> (specified on the command-line) that control them.
|
||||||
<p><code class="flag">--disable-disk-cache</code></p>
|
<p><code class="flag">--disable-disk-cache</code></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="setting">
|
||||||
|
<td>
|
||||||
|
<p class="name">
|
||||||
|
<strong>Ignore theme configuration</strong>
|
||||||
|
<span class="version-badge" title="Introduced in v4.1.0">4.1.0</span>
|
||||||
|
</p>
|
||||||
|
<p class="description">
|
||||||
|
Jekyll 4.0 started allowing themes to bundle a <code>_config.yml</code>
|
||||||
|
to simplify theme-onboarding for new users.
|
||||||
|
In the unfortunate situation that importing a bundled theme configuration
|
||||||
|
messes up the merged site-configuration, the user can configure Jekyll
|
||||||
|
to not import the theme-config entirely.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="align-center">
|
||||||
|
<p><code class="option">ignore_theme_config: BOOL</code></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="setting">
|
<tr class="setting">
|
||||||
<td>
|
<td>
|
||||||
<p class="name"><strong>Exclude</strong></p>
|
<p class="name"><strong>Exclude</strong></p>
|
||||||
|
|
|
@ -11,6 +11,17 @@ Feature: Bundling Config file with Theme gems
|
||||||
And the _site directory should exist
|
And the _site directory should exist
|
||||||
And I should see "aero" in "_site/index.html"
|
And I should see "aero" in "_site/index.html"
|
||||||
|
|
||||||
|
Scenario: Disabling import of theme configuration entirely
|
||||||
|
Given I have a configuration file with:
|
||||||
|
| key | value |
|
||||||
|
| theme | test-theme |
|
||||||
|
| ignore_theme_config | true |
|
||||||
|
And I have an "index.md" page that contains "{{ site.test_theme.skin }}"
|
||||||
|
When I run jekyll build
|
||||||
|
Then I should get a zero exit status
|
||||||
|
And the _site directory should exist
|
||||||
|
And I should not see "aero" in "_site/index.html"
|
||||||
|
|
||||||
Scenario: A pre-configured theme with valid config file overriding Jekyll defaults
|
Scenario: A pre-configured theme with valid config file overriding Jekyll defaults
|
||||||
Given I have a configuration file with "theme" set to "test-theme"
|
Given I have a configuration file with "theme" set to "test-theme"
|
||||||
And I have an "index.md" page that contains "{{ site.baseurl }}"
|
And I have an "index.md" page that contains "{{ site.baseurl }}"
|
||||||
|
|
|
@ -432,6 +432,8 @@ module Jekyll
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_theme_configuration(config)
|
def load_theme_configuration(config)
|
||||||
|
return config if config["ignore_theme_config"] == true
|
||||||
|
|
||||||
theme_config_file = in_theme_dir("_config.yml")
|
theme_config_file = in_theme_dir("_config.yml")
|
||||||
return config unless File.exist?(theme_config_file)
|
return config unless File.exist?(theme_config_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue