This package has been deprecated

Author message:

unmaintained

sourcemap-filename

0.0.5 • Public • Published

sourcemap-filename Build Status

The convention for sourcemap file names is to simply append '.map' to the entire file name. Unfortunately some CMSs don't support multiple extensions (I'm looking at you, Magnolia), so occasionally one needs something more flexible.

Installation

npm install sourcemap-filename

API

The module exports a function that has two parameters:

  • {string} sourceFile
  • {string} [pattern]

If the module is called without pattern

'.map' is appended to sourceFile.

If the module is called with pattern

The entire base file name of sourceFile is replaced by pattern. pattern supports two backreferences:

  • $1: the base file name without extension
    • example: for 'beep/boop.js', $1 references 'boop'
  • $2: the file extension without the leading dot
    • example: for 'beep/boop.js', $2 references 'js'

Usage

var sourcemapFilename = require('sourcemap-filename');
var sourceFile = 'beep.js';
var mapFile = sourcemapFilename(sourceFile); // beep.js.map
var pattern = '$1-$2_map.json';
mapFile = sourcemapFilename(sourceFile, pattern); // beep-js_map.json

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i sourcemap-filename

Weekly Downloads

0

Version

0.0.5

License

MIT

Last publish

Collaborators

  • randonneur