Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Compile Sass with Gulp Source maps for JavaScript too

Source map for minified script.

If you're also using the minify task, how do you build a source map of the minified js file?

2 Answers

Iain Diamond
Iain Diamond
29,379 Points

The same technique, using

maps = require('gulp-sourcemaps'); 

seems to work for Sass and JS files:

gulp.task('uglifyJS', ['concatJS'], function() {
  return gulp.src("js/app.js")
    .pipe(maps.init())
    .pipe(uglify())
    .pipe(maps.write('./'))
    .pipe(rename('app.min.js'))
    .pipe(gulp.dest('js'));
});

gulp.task('compileSass', function() {
  return gulp.src('scss/application.scss')
    .pipe(maps.init())
    .pipe(sass({
      outputStyle: 'compressed'
    }))
    .pipe(maps.write('./'))
    .pipe(gulp.dest('css'));
});

Hope this helps, iain

I see you get 'Lain' as well... it's tough having an uncommon spelling of a common name! :)

Hey thanks, Lain. That worked for me.