Sha256: 130808ca2f2d72bb30783b0217f16e8139dc6bbbfb228a4ef35021ab87ba61bc

Contents?: true

Size: 760 Bytes

Versions: 16

Compression:

Stored size: 760 Bytes

Contents

module Jekyll
  module AssetsPlugin
    class AssetPath
      attr_writer :anchor, :query

      def initialize(asset)
        asset.bundle!
        @asset = asset
      end

      def cachebust
        @cachebust ||= @asset.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

        return if query.empty?

        "?" << query.join("&")
      end

      def anchor
        "##{@anchor}" if @anchor
      end

      def to_s
        "#{@asset.site.assets_config.baseurl}/#{path}#{query}#{anchor}"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
jekyll-assets-0.14.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.13.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.12.1 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.12.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.11.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.10.1 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.10.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.9.2 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.9.1 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.9.0 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.8.1 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.8.0 lib/jekyll/assets_plugin/asset_path.rb
tgfa-jekyll-assets-0.7.9.2 lib/jekyll/assets_plugin/asset_path.rb
tgfa-jekyll-assets-0.7.9.1 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.7.9 lib/jekyll/assets_plugin/asset_path.rb
jekyll-assets-0.7.8 lib/jekyll/assets_plugin/asset_path.rb