File: README.md

package info (click to toggle)
node-concat-with-sourcemaps 1.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 104 kB
  • sloc: makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Concat with source maps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url]

NPM module for concatenating files and generating source maps.

### Usage example
```js
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).

[npm-image]: https://img.shields.io/npm/v/concat-with-sourcemaps.svg
[npm-url]: https://www.npmjs.com/package/concat-with-sourcemaps
[travis-image]: https://img.shields.io/travis/floridoo/concat-with-sourcemaps.svg
[travis-url]: https://travis-ci.org/floridoo/concat-with-sourcemaps
[coveralls-image]: https://img.shields.io/coveralls/floridoo/concat-with-sourcemaps.svg
[coveralls-url]: https://coveralls.io/r/floridoo/concat-with-sourcemaps?branch=master