add source map for compiled javascript
authorDaniel Mulholland <dan.mulholland@gmail.com>
Sat, 29 Dec 2018 10:02:00 +0000 (23:02 +1300)
committerDan Allen <dan@opendevise.com>
Mon, 17 Jun 2019 02:37:54 +0000 (20:37 -0600)
gulp.d/tasks/build.js
package.json

index 6f2db23..226a230 100644 (file)
@@ -17,6 +17,7 @@ const postcssImport = require('postcss-import')
 const postcssUrl = require('postcss-url')
 const postcssVar = require('postcss-custom-properties')
 const uglify = require('gulp-uglify')
+const sourcemaps = require('gulp-sourcemaps')
 const vfs = require('vinyl-fs')
 
 module.exports = (src, dest, preview) => () => {
@@ -45,8 +46,10 @@ module.exports = (src, dest, preview) => () => {
   return merge(
     vfs
       .src('js/+([0-9])-*.js', opts)
+      .pipe(sourcemaps.init())
       .pipe(uglify())
-      .pipe(concat('js/site.js')),
+      .pipe(concat('js/site.js'))
+      .pipe(sourcemaps.write('.')),
     vfs
       .src('js/vendor/*.js', { ...opts, read: false })
       .pipe(
index 0ba8142..8014891 100644 (file)
@@ -29,6 +29,7 @@
     "gulp-eslint": "~5.0",
     "gulp-imagemin": "~5.0",
     "gulp-postcss": "~8.0",
+    "gulp-sourcemaps": "~2.6",
     "gulp-stylelint": "~8.0",
     "gulp-uglify": "~3.0",
     "gulp-vinyl-zip": "~2.1 >=2.1.2",