Sha256: 82673f8a284a664a2945f42cfde031ac8f3074c61e386134814a0444fd953970

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# Frozen-string-literal: true
# Copyright: 2012-2015 - MIT License
# Encoding: utf-8

module Jekyll
  module Assets
    module Config
      DefaultSources = %W(
        _assets/css _assets/stylesheets
        _assets/images _assets/img _assets/fonts
        _assets/javascripts _assets/js
      )

      Development = {
        "skip_baseurl_with_cdn" => false,
        "skip_prefix_with_cdn"  => false,
        "prefix"    => "/assets",
        "digest"    => false,
        "assets"    => [],

        "compress"  => {
          "css"     => false,
          "js"      => false
        }
      }

      #

      Production = Development.merge({
        "digest"    => true,
        "compress"  => {
          "css"     => true,
          "js"      => true
        },
      })

      #

      def self.merge_sources(jekyll, config)
        config["sources"] = (DefaultSources + (config["sources"] ||= [])).map do |val|
          jekyll.in_source_dir(val)
        end
      end

      #

      def self.defaults
        %W(development test).include?(Jekyll.env) ? Development : Production
      end

      #

      def self.merge(new_hash, old_hash = defaults)
        old_hash.merge(new_hash) do |key, old_val, new_val|
          old_val.is_a?(Hash) && new_val.is_a?(Hash) ? merge(new_val, old_val) : new_val
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-assets-2.0.1 lib/jekyll/assets/config.rb