[英]Gulp-sourcemaps not creating a sourcemap file?
I'm trying to get Gulp sourcemaps to write files, but I can't see these files anywhere. 我正在尝试使用Gulp源图来编写文件,但我无法在任何地方看到这些文件。 If any new files were created in the working tree, I would see them in git status
, but nothing no new files to be found. 如果在工作树中创建了任何新文件,我会看到它们处于git status
,但没有任何新文件可以找到。
Below is my gulpfile.js 下面是我的gulpfile.js
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
minify = require('gulp-minify'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
gulp.task('js', function() {
return gulp.src('src/js/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('all.js'))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/js'));
});
Is this correct usage? 这是正确的用法吗? From the examples I've seen elsewhere, this should be OK. 从我在别处看到的例子来看,这应该没问题。 I also see that these plugins are compatable with sourcemaps: https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support 我还看到这些插件可与源图混合: https : //github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support
Using the sourcemaps.write()
method the way you do appends a source maps line to the all.js
file. 使用sourcemaps.write()
方法将源映射行附加到all.js
文件。 If you want to write external source map files, you'll need to pass the path to the sourcemaps.write()
method: 如果要编写外部源映射文件,则需要将路径传递给sourcemaps.write()
方法:
sourcemaps.write('../maps')
https://www.npmjs.com/package/gulp-sourcemaps https://www.npmjs.com/package/gulp-sourcemaps
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.