最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Gulp-sourcemaps not creating a sourcemap file? - Stack Overflow

programmeradmin2浏览0评论

I'm trying to get Gulp sourcemaps to write files, but I can't see these files anywhere. 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.

Below is my 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 patable with sourcemaps:

I'm trying to get Gulp sourcemaps to write files, but I can't see these files anywhere. 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.

Below is my 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 patable with sourcemaps: https://github./floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support

Share Improve this question asked Oct 10, 2015 at 13:30 MartynMartyn 6,38312 gold badges62 silver badges131 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

Using the sourcemaps.write() method the way you do appends a source maps line to the all.js file. If you want to write external source map files, you'll need to pass the path to the sourcemaps.write() method:

sourcemaps.write('../maps')

https://www.npmjs./package/gulp-sourcemaps

发布评论

评论列表(0)

  1. 暂无评论