Sha256: 1c4087568bda9be25a79d6c16eb9ba17b783fa5b27e1b6ab31b6b17dc4929f37
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# stdlib require "ostruct" module Jekyll module AssetsPlugin class Configuration DEFAULTS = { :dirname => "assets", :sources => %w{_assets/javascripts _assets/stylesheets _assets/images}, :compress => { :css => nil, :js => nil }, :cachebust => :hard }.freeze def initialize config = {} @data = OpenStruct.new DEFAULTS.merge(config) @data.sources = [ @data.sources ] if @data.sources.is_a? String @data.compress = OpenStruct.new @data.compress @data.dirname = @data.dirname.gsub(/^\/+|\/+$/, "") # if baseurl not given - autoguess base on dirname @data.baseurl ||= "/#{@data.dirname}/".squeeze '/' end def baseurl @data.baseurl.chomp "/" end def js_compressor compressor @data.compress.js end def css_compressor compressor @data.compress.css end def cachebust none?(@data.cachebust) ? :none : @data.cachebust.to_sym end def method_missing name, *args, &block @data.send name, *args, &block end protected def none? val val.nil? || val.empty? || "none" == val.to_s.downcase end def compressor val none?(val) ? nil : val.to_sym end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-0.3.4 | lib/jekyll/assets_plugin/configuration.rb |
jekyll-assets-0.3.3 | lib/jekyll/assets_plugin/configuration.rb |
jekyll-assets-0.3.2 | lib/jekyll/assets_plugin/configuration.rb |