1. concat-with-sourcemaps
Concatenate file contents with a custom separator and generate a source map
concat-with-sourcemaps
Package: concat-with-sourcemaps
Created by: floridoo
Last modified: Mon, 13 Jun 2022 20:38:35 GMT
Version: 1.1.0
License: ISC
Downloads: 5,542,813
Repository: https://github.com/floridoo/concat-with-sourcemaps

Install

npm install concat-with-sourcemaps
yarn add concat-with-sourcemaps

Concat with source maps NPM version build status Test coverage

NPM module for concatenating files and generating source maps.

Usage example

 var concat = new Concat(true, 'all.js', '\n');
concat.add(null, "// (c) John Doe");
concat.add('file1.js', file1Content);
concat.add('file2.js', file2Content, file2SourceMap);

var concatenatedContent = concat.content;
var sourceMapForContent = concat.sourceMap;

API

new Concat(generateSourceMap, outFileName, separator)

Initialize a new concat object.

Parameters:

  • generateSourceMap: whether or not to generate a source map (default: false)
  • outFileName: the file name/path of the output file (for the source map)
  • separator: the string that should separate files (default: no separator)

concat.add(fileName, content, sourceMap)

Add a file to the output file.

Parameters:

  • fileName: file name of the input file (can be null for content without a file reference, e.g. a license comment)
  • content: content (Buffer or string) of the input file
  • sourceMap: optional source map of the input file (string). Will be merged into the output source map.

concat.content

The resulting concatenated file content (Buffer).

concat.sourceMap

The resulting source map of the concatenated files (string).

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code