Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Accept multiple configuration files #703

Closed
parkr opened this Issue · 5 comments

5 participants

@parkr
Owner

It'd be cool if there were some way to cascade multiple config files.

jekyll -c _config.yml _site.yml _github.yml

It would gobble everything after the -c but before the next switch.

Other comments on this in #692.

@tombell

What's the appeal of this? I don't see why someone would spread configuration variables over multiple files.

@parkr
Owner

I'm happy to explain.

If I have default configurations in a couple files and personal configurations in another, this is the easiest way to merge them together and have one big set of configs available to site. Or maybe I prefer to keep my jekyll-specific configurations in one file and my site customizations (variables for use in liquid) in another. I could do jekyll -c jekyll.yml site.yml and have all the variables available to my templates, while still allowinf for the logical separation of the disparate configurations.

@agarie

We could have "standard configurations", too. A theme could have its own config file and the user would be able to overwrite it in another one, without alteration to the theme's files.

@xenji

I'm close to having a pull request ready. With glob includes and circular reference detection ... The tests for the classic configuration method still work, but there are some of my new tests still failing.

@xenji xenji referenced this issue from a commit
@xenji xenji Added config includes to solve #514 and #703
including the corresponding tests and fixtures.

You can now use a YAML list to add configuration files to be included
in the order of the list. The main configuration is included at the
final step to ensure that every value can be overridden.

The syntax supports globs (to be used with `Dir[pattern]`), relative
paths to the config value of `source` and absolute paths.

Using this sample config:
```
additional_configs:
  - additional_configs/_config_a.yml
  - additional_configs/_config_b.yml
```
or the glob version:
```
additional_configs:
  - additional_configs/_config_*.yml
```
the new deep merge order is in both cases:
`Jekyll::DEFAULTS < _config_a < _config_b < _config`

Using globs means to rely on the sorting that Dir[pattern] resolves.

I've added additional tests for three use cases:
* Having one inclusion
* Having a glob inclusion
* Having one inclusion with override in the main config
2961201
@parkr parkr closed this
@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles

Hi, long time listener, first time caller. I am currently working on a project that could really use multiple _config.yml files. I found this patch which is perfect, and decided to see if I updated the code and got it to pass the tests if it could be reconsidered.

I have made some minor changes to @xenji. He should get most of the credit.

@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles voidfiles referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@voidfiles voidfiles referenced this issue from a commit in voidfiles/jekyll
@voidfiles voidfiles Added config includes to solve #514 and #703
This is origonaly form this checkin.
xenji/jekyll@2961201

I have only tried to cherry pick it on top of the current source
tree
including the corresponding tests and fixtures.

You can now use a YAML list to add configuration files to be included
in the order of the list.

The syntax supports globs (to be used with `Dir[pattern]`), relative
paths to the config value of `source` and absolute paths.

Using this sample config:
```
additional_configs:
  - additional_configs/_config_a.yml
  - additional_configs/_config_b.yml
```
or the glob version:
```
additional_configs:
  - additional_configs/_config_*.yml
```
the new deep merge order is in both cases:
`Jekyll::DEFAULTS < _config < _config_a < _config_b`

I've added additional tests for three use cases:
* Having one inclusion
* Having a glob inclusion
* Having one inclusion with override in the main config

Conflicts:
	lib/jekyll/configuration.rb
	test/test_configuration.rb
e38e4b2
@voidfiles voidfiles referenced this issue from a commit in voidfiles/jekyll
@voidfiles voidfiles Accept multiple config files from command line
Parse config as if it can contain multiple references to config files.
This allows you to pass in multiple config files from the command line

Helps with issues #514 and #703
df1efef
@mattr- mattr- referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.