add sourcemaps to gulp pipelines
This commit is contained in:
parent
11d96c44d1
commit
a1558fa00f
5 changed files with 2592 additions and 2441 deletions
|
@ -10,6 +10,7 @@ const uglify = require('gulp-uglify-es').default;
|
|||
const webpackStream = require('webpack-stream');
|
||||
const webpackConfig = require('./webpack.config.js');
|
||||
const sourcemaps = require('gulp-sourcemaps');
|
||||
const through = require('through2');
|
||||
|
||||
const argv = require('yargs')
|
||||
.default('production', false)
|
||||
|
@ -29,6 +30,11 @@ const paths = {
|
|||
},
|
||||
};
|
||||
|
||||
const clearSourcemaps = through.obj(function (file, enc, cb) {
|
||||
if (!/\.map$/.test(file.path)) this.push(file);
|
||||
cb();
|
||||
});
|
||||
|
||||
/**
|
||||
* Build un-compiled CSS into a minified version.
|
||||
*/
|
||||
|
@ -56,7 +62,8 @@ function styles() {
|
|||
*/
|
||||
function scripts() {
|
||||
return webpackStream(webpackConfig)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(clearSourcemaps)
|
||||
.pipe(babel())
|
||||
.pipe(gulpif(argv.production, uglify()))
|
||||
.pipe(concat('bundle.js'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue