Sha256: 3c2fa5b87c0938208e2bc3b69f83eab8c9da457836fe8ea35cf392d2bd1f73d7

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 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

        "?#{query.join '&'}" unless query.empty?
      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

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-assets-0.7.7 lib/jekyll/assets_plugin/asset_path.rb