Gulp-sourcemaps不起作用?

时间:2018-07-12 14:43:04

标签: gulp gulp-sourcemaps

我对使用gulp并不陌生,我正在尝试使gulp-sourcemaps工作,以便在浏览器中调试时可以看到我的实际文件。但这是行不通的。

const gulp = require('gulp');
const uglify = require('gulp-uglify');
const pump = require('pump');
const livereload = require('gulp-livereload');
const concat= require('gulp-concat');
const minifyCSS =require('gulp-minify-css');
const autoprefixer= require('gulp-autoprefixer');
const plumber = require('gulp-plumber');
const sourcemaps = require('gulp-sourcemaps');

// File path
const SCRIPTS_PATH = 'public/scripts/**/*.js'
const CSS_PATH = 'public/css/**/*.css';
const DIST_PATH = 'public/dist'

gulp.task('styles', function () {
   pump([
       gulp.src(['public/css/reset.css',CSS_PATH]),
       sourcemaps.init(),
       plumber((err)=>{
            console.log("Styles Task Error");
            console.log(err);
            this.emit('end');
       }),
       autoprefixer({
           browsers:['last 2 versions']
       }),
       concat('styles.css'),
       minifyCSS(),
       sourcemaps.write(),
       gulp.dest(DIST_PATH),
       livereload(),
   ])
})

0 个答案:

没有答案