gulp-concat-sourcemap
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -33,2 +33,9 @@ 'use strict'; | ||
if(opts.prefix) { | ||
var p = opts.prefix; | ||
while(p-- > 0) { | ||
rel = rel.substring(rel.indexOf('/') + 1); | ||
} | ||
} | ||
file.contents.toString('utf8').split('\n').forEach(function(line, j){ | ||
@@ -35,0 +42,0 @@ sourceNode.add(new SourceNode(j + 1, 0, rel, line + '\n')); |
{ | ||
"name": "gulp-concat-sourcemap", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Concatenate files and generate a source map file", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,2 +26,5 @@ gulp-concat-sourcemap [![Build Status](https://travis-ci.org/mikach/gulp-concat-sourcemap.png?branch=master)](https://travis-ci.org/mikach/gulp-concat-sourcemap) | ||
`options.sourceRoot` | ||
An optional root for all relative URLs in the source map. | ||
An optional root for all relative URLs in the source map. | ||
`options.prefix` | ||
Skip prefix for original filenames that appear in source maps. For example {prefix: 3} will drop 3 directories from file names. |
@@ -54,2 +54,41 @@ var expect = require('chai').expect; | ||
}); | ||
it('should prefix sourcemap output', function(done) { | ||
var file1 = new File({ | ||
base: '/test', | ||
path: 'test/path/file1.js', | ||
contents: new Buffer('console.log(\'Hello\');') | ||
}); | ||
var file2 = new File({ | ||
base: '/test', | ||
path: 'test/path/file2.js', | ||
contents: new Buffer('console.log(\'World\');') | ||
}); | ||
var stream = concat('file.js', {prefix: 2}); | ||
var contentFile; | ||
stream.on('data', function(newFile) { | ||
if (!contentFile) { // contentFile | ||
contentFile = newFile; | ||
expect(String(newFile.contents)).to.be.equal( | ||
'console.log(\'Hello\');' + | ||
'\n\nconsole.log(\'World\');\n\n' + | ||
'//# sourceMappingURL=file.js.map' | ||
); | ||
} else { // mapFile | ||
expect(String(newFile.contents)).to.be.equal( | ||
'{\n \"version\": 3,\n \"file\": \"file.js\",' + | ||
'\n \"sources\": [\n \"file1.js\",\n \"file2.js\"\n ]' + | ||
',\n \"names\": [],\n \"mappings\": \"AAAA;;ACAA\"\n}' | ||
); | ||
done(); | ||
} | ||
}); | ||
stream.write(file1); | ||
stream.write(file2); | ||
stream.end(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8886
148
29