Skip to content

Commit

Permalink
add sourcemaps to gulp pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
schrej committed May 31, 2018
1 parent 11d96c4 commit a1558fa
Show file tree
Hide file tree
Showing 5 changed files with 2,592 additions and 2,441 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ APP_CLEAR_TASKLOG=720
APP_DELETE_MINUTES=10
APP_ENVIRONMENT_ONLY=true
LOG_CHANNEL=daily
APP_

DB_HOST=127.0.0.1
DB_PORT=3306
Expand Down
9 changes: 8 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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'))
Expand Down
Loading

0 comments on commit a1558fa

Please sign in to comment.