parent
fec13b3d05
commit
052dbf8b98
|
@ -4,9 +4,9 @@ permalink: /docs/configuration/
|
||||||
---
|
---
|
||||||
|
|
||||||
Jekyll gives you a lot of flexibility to customize how it builds your site. These
|
Jekyll gives you a lot of flexibility to customize how it builds your site. These
|
||||||
options can either be specified in a `_config.yml` file placed in your site’s
|
options can either be specified in a `_config.yml` or `_config.toml` file placed
|
||||||
root directory, or can be specified as flags for the `jekyll` executable in the
|
in your site’s root directory, or can be specified as flags for the `jekyll`
|
||||||
terminal.
|
executable in the terminal.
|
||||||
|
|
||||||
* [Configuration Options](/docs/configuration/options/)
|
* [Configuration Options](/docs/configuration/options/)
|
||||||
* [Default Configuration](/docs/configuration/default/)
|
* [Default Configuration](/docs/configuration/default/)
|
||||||
|
|
|
@ -154,7 +154,7 @@ module Jekyll
|
||||||
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
# Get configuration from <source>/_config.yml or <source>/<config_file>
|
||||||
config_files = override["config"]
|
config_files = override["config"]
|
||||||
if config_files.to_s.empty?
|
if config_files.to_s.empty?
|
||||||
default = %w(yml yaml).find(-> { "yml" }) do |ext|
|
default = %w(yml yaml toml).find(-> { "yml" }) do |ext|
|
||||||
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
|
||||||
end
|
end
|
||||||
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
|
||||||
|
|
|
@ -143,6 +143,17 @@ class TestConfiguration < JekyllUnitTest
|
||||||
allow(File).to receive(:exist?).with(source_dir("_config.yml")).and_return(true)
|
allow(File).to receive(:exist?).with(source_dir("_config.yml")).and_return(true)
|
||||||
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
||||||
end
|
end
|
||||||
|
should "return .toml if that exists" do
|
||||||
|
allow(File).to receive(:exist?).with(source_dir("_config.yml")).and_return(false)
|
||||||
|
allow(File).to receive(:exist?).with(source_dir("_config.yaml")).and_return(false)
|
||||||
|
allow(File).to receive(:exist?).with(source_dir("_config.toml")).and_return(true)
|
||||||
|
assert_equal [source_dir("_config.toml")], @config.config_files(@no_override)
|
||||||
|
end
|
||||||
|
should "return .yml if both .yml and .toml exist" do
|
||||||
|
allow(File).to receive(:exist?).with(source_dir("_config.yml")).and_return(true)
|
||||||
|
allow(File).to receive(:exist?).with(source_dir("_config.toml")).and_return(true)
|
||||||
|
assert_equal [source_dir("_config.yml")], @config.config_files(@no_override)
|
||||||
|
end
|
||||||
should "return the config if given one config file" do
|
should "return the config if given one config file" do
|
||||||
assert_equal %w(config.yml), @config.config_files(@one_config_file)
|
assert_equal %w(config.yml), @config.config_files(@one_config_file)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue