Module: Jekyll::Assets::Plugins::SrcMap

Defined in:
lib/jekyll/assets/plugins/srcmap.rb,
lib/jekyll/assets/plugins/srcmap/writer.rb

Defined Under Namespace

Classes: Writer

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.map_path(env:, asset:) ⇒ String

Note:

this just saves logic.

– Take the path, and attach the map extension. –

Returns:

  • (String)

    the map name.



24
25
26
27
28
29
30
31
32
# File 'lib/jekyll/assets/plugins/srcmap.rb', line 24

def self.map_path(env:, asset:)
  [
    path({
      asset: asset,
      env: env,
    }),
    EXT,
  ].join
end

.path(env:, asset:) ⇒ Pathutil

Note:

this is used for anything in source-maps.

– Strip the filename and return a relative sourcemap path. –

Returns:

  • (Pathutil)

    the path.



39
40
41
42
# File 'lib/jekyll/assets/plugins/srcmap.rb', line 39

def self.path(env:, asset:)
  DIR.join(env.strip_paths(asset.is_a?(Sprockets::Asset) ?
    asset.filename : asset))
end