2

In a Jekyll site one excludes files like this:

exclude:
    - "*.json"
    - "Gemfile*"
    - "*.txt"
    - vendor
    - README.md
    - somefile.html

So to create the production build I run: $ JEKYLL_ENV=production bundle exec jekyll build

How can I exclude the somefile.html file only when I run the production ENV?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Bob van Luijt
  • 7,153
  • 12
  • 58
  • 101

1 Answers1

3

Perhaps you could try using a specific config file for production and one for development. In the production you could exclude the files using exclude as described here.

Then run:

jekyll build --trace --config _config.yml,_config_dev.yml

or

jekyll build --trace --config _config.yml,_config_prod.yml

In the _config.yml you'd set generic settings, and in the config with the environment suffix you'd set a environment specific configuration.


The trace flag is optional, it will help setting it up since it will show occuring errors.

optional: -t, --trace Show the full backtrace when an error occurs

Remi
  • 4,663
  • 11
  • 49
  • 84
  • Yes, thanks for sharing, also possible: https://stackoverflow.com/a/30899655/1501285 – Bob van Luijt May 01 '18 at 18:46
  • 1
    Isn't that the same as stated above however with `"..."`? The trace is optional of course to potentially debug once you're setting it up. I'll add the note. – Remi May 02 '18 at 11:38