S
S
Sergey delphinpro2015-02-28 23:07:49
gulp.js
Sergey delphinpro, 2015-02-28 23:07:49

How to make gulp-sourcemap work correctly?

For some reason gulp-sourcemaps generates incorrect codemaps.
There is a task to write a task that will process sass sources, add vendor prefixes and compress css in "compact" mode (in sass-compass terminology).
We use gulp-sourcemaps + gulp-compass + gulp-autoprefixer . We write:

gulp.src('src/sass/')
  .pipe(plumber())
  .pipe(sourcemaps.init())
  .pipe(compass({
    style    : 'compact',
    sourcemap: false,
    css      : 'build/css/',
    sass     : 'src/sass/'
  }))
  .pipe(prefixer())
  .pipe(sourcemaps.write('.'))
  .pipe(gulp.dest('build/css/'))
  .pipe(connect.reload());

As a result, firefox does not read the resulting map :(, i.e. it does not show addressing to source sass files.
If we throw away sourcemaps and autoprefixer, then compass itself will generate a completely correct map.
gulp.src('src/sass/')
  .pipe(plumber())
  .pipe(compass({
    style    : 'compact',
    sourcemap: true,
    css      : 'build/css/',
    sass     : 'src/sass/'
  }))
  .pipe(gulp.dest('build/css/'))
  .pipe(connect.reload());

I tried to use gulp-sass instead of gulp-compass, the result is zero, the maps are incorrect.
UPD 11/11/2015
Today I decided to return to the cards. I installed the latest version of the gulp-sourcemaps package and everything started up without shamanism, all with the same tasks as described above.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Pastukhov, 2015-06-04
@delphinpro

Inside the gulp-sourcemaps plugin, there should be plugins that are supported by it (on the plugin page it says: All plugins between sourcemaps.init() and sourcemaps.write() need to have support for gulp-sourcemaps. ). Supported plugins: wiki

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question