gulp-sourcemaps
Advanced tools
Comparing version 1.0.0 to 1.1.0
12
index.js
@@ -144,7 +144,13 @@ 'use strict'; | ||
if (options.sourceRoot) | ||
sourceMap.sourceRoot = options.sourceRoot; | ||
if (options.sourceRoot) { | ||
if (typeof options.sourceRoot === 'function') { | ||
sourceMap.sourceRoot = options.sourceRoot(file); | ||
} else { | ||
sourceMap.sourceRoot = options.sourceRoot; | ||
} | ||
} | ||
if (options.includeContent) { | ||
sourceMap.sourceRoot = options.sourceRoot || '/source/'; | ||
sourceMap.sourceRoot = sourceMap.sourceRoot || '/source/'; | ||
sourceMap.sourcesContent = sourceMap.sourcesContent || []; | ||
@@ -151,0 +157,0 @@ |
{ | ||
"name": "gulp-sourcemaps", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Source map support for Gulp.js", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/floridoo/gulp-sourcemaps", |
@@ -105,3 +105,3 @@ ## gulp-sourcemaps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] | ||
Set the path where the source files are hosted (use this when `includeContent` is set to `false`). This is an URL (or subpath) relative to the source map, not a local file system path. If you have sources in different subpaths, an absolute path (from the domain root) pointing to the source file root is recommended. | ||
Set the path where the source files are hosted (use this when `includeContent` is set to `false`). This is an URL (or subpath) relative to the source map, not a local file system path. If you have sources in different subpaths, an absolute path (from the domain root) pointing to the source file root is recommended, or define it with a function. | ||
@@ -120,2 +120,19 @@ Example: | ||
Example (using a function): | ||
```javascript | ||
gulp.task('javascript', function() { | ||
var stream = gulp.src('src/**/*.js') | ||
.pipe(sourcemaps.init()) | ||
.pipe(concat('all.js')) | ||
.pipe(uglify()) | ||
.pipe(sourcemaps.write({ | ||
includeContent: false, | ||
sourceRoot: function(file) { | ||
return '/src'; | ||
} | ||
})) | ||
.pipe(gulp.dest('dist')); | ||
}); | ||
``` | ||
### Plugin developers only: How to add source map support to plugins | ||
@@ -122,0 +139,0 @@ |
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
12864
176
181