Added config includes to solve #514 and #703 #722

Closed
wants to merge 2 commits into
from

2 participants

@xenji

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
@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
@xenji

@StevenBlack As written above, using globs means to rely on the sorting that Dir[pattern] resolves. This means in general, that your OS will take over the sorting and give it back to the ruby interpreter. As far as I know, you should not see any differences between file systems, but I won't bet on it.

I think a sorting like

10-less-important.yml
20-more-important.yml
99-most-important.yml

might be suitable to ensure an order on most file systems. If you need any of the configs at first and cannot change it's name, you might name it explicitly before the wildcard include. The patch checks for already included files and won't do it twice.

additional_configs:
  - additional_configs/_config_very_important.yml
  - additional_configs/_config_*.yml

HTH?

@parkr
Jekyll member

We're going to go with a simpler solution via the CLI.

@parkr parkr closed this Mar 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment