Sha256: d53eb37b043e61248f8662ad96b5ad0f9142d16bb40e6648591870625b482531
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
module Jekyll module AssetsPlugin class AssetPath attr_reader :asset def initialize site, pathname, *args pathname, _, @anchor = pathname.rpartition "#" if pathname["#"] pathname, _, @query = pathname.rpartition "?" if pathname["?"] @asset = site.assets[pathname, *args] @site = site site.bundle_asset! asset end def cachebust @cachebust ||= @site.assets_config.cachebust end def path :hard == cachebust && asset.digest_path || asset.logical_path end def query query = [] query << "cb=#{asset.digest}" if :soft == cachebust query << @query if @query "?#{query.join '&'}" unless query.empty? end def anchor "##{@anchor}" if @anchor end def to_s "#{@site.assets_config.baseurl}/#{path}#{query}#{anchor}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-0.7.0 | lib/jekyll/assets_plugin/asset_path.rb |