Skip to content

Instantly share code, notes, and snippets.

@afomi
Created December 8, 2023 20:07
Show Gist options
  • Save afomi/f1ebde66d85c5252b51405b8c8aec4b9 to your computer and use it in GitHub Desktop.
Save afomi/f1ebde66d85c5252b51405b8c8aec4b9 to your computer and use it in GitHub Desktop.
# script.rb
require 'yaml'
# Load the existing configuration
config = YAML.load_file('_config.yml')
# Modify the configuration using ENV variables
config['some_setting'] = ENV['MY_ENV_VARIABLE'] || 'default_value'
# Write the modified configuration to a new file
File.open('_config_temp.yml', 'w') { |f| f.write(config.to_yaml) }
# Now use this config file to build the Jekyll site
system("jekyll build --config _config_temp.yml")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment