Sha256: bd884ebc35bd6daebe3d1b07e8aa910b5f2e7380f8b97f82134f58732badfad4

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

# Frozen-string-literal: true
# Copyright: 2012 - 2018 - MIT License
# Encoding: utf-8

unless Jekyll::Assets::Utils.old_sprockets?
  require_relative "srcmap/css"
  require_relative "srcmap/javascript"
  require_relative "srcmap/writer"

  module Jekyll
    module Assets
      module Plugins
        module SrcMap
          NAME = "%<name>s.map"
          DIR_NAME = "source-maps"
          DIR = Pathutil.new(DIR_NAME)
          EXT = ".map"

          # --
          # @return [String] the map name.
          # Take the path, and attach the map extension.
          # @note this just saves logic.
          # --
          def self.map_path(env:, asset:)
            [
              path({
                asset: asset,
                env: env,
              }),
              EXT,
            ].join
          end

          # --
          # @note this is used for anything in source-maps.
          # Strip the filename and return a relative sourcemap path.
          # @return [Pathutil] the path.
          # --
          def self.path(env:, asset:)
            DIR.join(env.strip_paths(asset.is_a?(Sprockets::Asset) ?
              asset.filename : asset))
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-assets-3.0.12 lib/jekyll/assets/plugins/srcmap.rb
jekyll-assets-3.0.11 lib/jekyll/assets/plugins/srcmap.rb
jekyll-assets-3.0.10 lib/jekyll/assets/plugins/srcmap.rb
jekyll-assets-3.0.9 lib/jekyll/assets/plugins/srcmap.rb
jekyll-assets-3.0.8 lib/jekyll/assets/plugins/srcmap.rb