Module: Jekyll::Minibundle::Environment

Defined in:
lib/jekyll/minibundle/environment.rb

Class Method Summary collapse

Class Method Details

.development?(site) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/jekyll/minibundle/environment.rb', line 11

def 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



16
17
18
19
20
21
22
# File 'lib/jekyll/minibundle/environment.rb', line 16

def 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



6
7
8
9
# File 'lib/jekyll/minibundle/environment.rb', line 6

def 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