Ensure theme config is a `Jekyll::Configuration` object (#8988)
Merge pull request 8988
This commit is contained in:
parent
0d0fd3f41b
commit
3b3f845846
|
|
@ -476,7 +476,11 @@ module Jekyll
|
||||||
theme_config.delete_if { |key, _| Configuration::DEFAULTS.key?(key) }
|
theme_config.delete_if { |key, _| Configuration::DEFAULTS.key?(key) }
|
||||||
|
|
||||||
# Override theme_config with existing config and return the result.
|
# Override theme_config with existing config and return the result.
|
||||||
|
# Additionally ensure we return a `Jekyll::Configuration` instance instead of a Hash.
|
||||||
Utils.deep_merge_hashes(theme_config, config)
|
Utils.deep_merge_hashes(theme_config, config)
|
||||||
|
.each_with_object(Jekyll::Configuration.new) do |(key, value), conf|
|
||||||
|
conf[key] = value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Limits the current posts; removes the posts which exceed the limit_posts
|
# Limits the current posts; removes the posts which exceed the limit_posts
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,12 @@ class TestSite < JekyllUnitTest
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "load config file from theme-gem as Jekyll::Configuration instance" do
|
||||||
|
site = fixture_site("theme" => "test-theme")
|
||||||
|
assert_instance_of Jekyll::Configuration, site.config
|
||||||
|
assert_equal "Hello World", site.config["title"]
|
||||||
|
end
|
||||||
|
|
||||||
context "with a custom cache_dir configuration" do
|
context "with a custom cache_dir configuration" do
|
||||||
should "have the custom cache_dir hidden from Git" do
|
should "have the custom cache_dir hidden from Git" do
|
||||||
site = fixture_site("cache_dir" => "../../custom-cache-dir")
|
site = fixture_site("cache_dir" => "../../custom-cache-dir")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue