0

Any help getting sourcemaps working with Gulp? This is my first project using Gulp and SASS together that I've setup and I'm find it impossible to debug with Developer tools with the minified css.

var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var header = require('gulp-header');
var cleanCSS = require('gulp-clean-css');
var rename = require("gulp-rename");
var uglify = require('gulp-uglify');
var pkg = require('./package.json');
var sourcemaps = require('source-map');

// Compiles SCSS files from /scss into /css
gulp.task('sass', function() {
  return gulp.src('scss/creative.scss')
    .pipe(sourcemaps.init())
    .pipe(sass())
    .pipe(header(banner, {
      pkg: pkg
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('css'))
    .pipe(browserSync.reload({
      stream: true
    }))
});
Stephen Selvey
  • 353
  • 2
  • 3
  • 11
  • You want https://www.npmjs.com/package/gulp-sourcemaps. – Mark Jan 03 '18 at 05:57
  • Hi Mark thanks for the response. This question may seem elementary but is there a difference installing through the command line and just downloading the folder and adding it to your project? I've tried installing that package through npm but I'm getting an error. – Stephen Selvey Jan 03 '18 at 17:05
  • Yes, there is a big difference between the two. Installing with npm or yarn will also install any dependencies and update your package.json. So only installing will work. What error are you getting when you "npm install --save-dev gulp-sourcemaps"? – Mark Jan 03 '18 at 18:37
  • I'm getting two errors: npm ERR! Cannot read property '0' of undefined and npm WARN bootstrap@4.0.0-beta.2 requires a peer of popper.js@^1.12.3 but none is installed. You must install peer dependencies yourself. – Stephen Selvey Jan 04 '18 at 03:52
  • 1
    Looks like downgrading my version of npm fixed the issue. – Stephen Selvey Jan 05 '18 at 14:29

0 Answers0