Module: Jekyll::Minibundle::Environment
- Defined in:
- lib/jekyll/minibundle/environment.rb
Class Method Summary collapse
- .development?(site) ⇒ Boolean
- .find_site_config(site, keys, type) ⇒ Object
- .minifier_command(site, type) ⇒ Object
Class Method Details
.development?(site) ⇒ Boolean
12 13 14 15 |
# File 'lib/jekyll/minibundle/environment.rb', line 12 def self.development?(site) mode = ENV['JEKYLL_MINIBUNDLE_MODE'] || Environment.find_site_config(site, %w[minibundle mode], String) mode == 'development' end |
.find_site_config(site, keys, type) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/jekyll/minibundle/environment.rb', line 17 def self.find_site_config(site, keys, type) value = Hashes.dig(site.config, *keys) if value && !value.is_a?(type) raise "Invalid site configuration for key #{keys.join('.')}; expecting type #{type}" end value end |
.minifier_command(site, type) ⇒ Object
7 8 9 10 |
# File 'lib/jekyll/minibundle/environment.rb', line 7 def self.minifier_command(site, type) type = type.to_s ENV["JEKYLL_MINIBUNDLE_CMD_#{type.upcase}"] || Environment.find_site_config(site, ['minibundle', 'minifier_commands', type], String) end |