Class: Jekyll::Assets::Config

Inherits:
HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/jekyll/assets/config.rb

Constant Summary collapse

DEVELOPMENT =
{
  digest: true,
  precompile: [],
  source_maps: true,
  destination: "/assets",
  compression: false,
  raw_precompile: [],
  defaults: {},
  gzip: false,

  compressors: {
    uglifier: {
      comments: false,
      harmony: Utils.new_uglifier?,
    },
  },

  caching: {
    path: ".jekyll-cache/assets",
    enabled: true,
    type: "file",
  },

  cdn: {
    baseurl: false,
    destination: false,
    url: nil,
  },

  sources: %w(
    assets/css
    assets/fonts
    assets/images
    assets/videos
    assets/audios
    assets/components
    assets/javascript
    assets/video
    assets/audio
    assets/image
    assets/img
    assets/js

    _assets/css
    _assets/fonts
    _assets/images
    _assets/videos
    _assets/audios
    _assets/components
    _assets/javascript
    _assets/video
    _assets/audio
    _assets/image
    _assets/img
    _assets/js

    css
    fonts
    images
    videos
    audios
    components
    javascript
    audio
    video
    image
    img
    js
  ),
}.freeze
PRODUCTION =
DEVELOPMENT.deep_merge({
  source_maps: false,
  compression: true,
}).freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config



91
92
93
94
95
96
# File 'lib/jekyll/assets/config.rb', line 91

def initialize(config)
  super(self.class.defaults)
  Hook.trigger(:config, :before_merge) { |h| h.call(self) }
  deep_merge!(config)
  merge_sources!
end

Class Method Details

.defaultsHashWithIndifferentAccess

Note:

this is useful if you are in safe mode.

– The original defaults we have set. –

Returns:

  • (HashWithIndifferentAccess)


103
104
105
# File 'lib/jekyll/assets/config.rb', line 103

def self.defaults
  Jekyll.dev? ? DEVELOPMENT : PRODUCTION
end