2
2
21f1nger2018-11-20 08:27:16
Sass
21f1nger, 2018-11-20 08:27:16

How to edit a Gulp task so that .map files are saved correctly?

Previously, the config saved .map in the body of the files - now there is a need to store them separately.
Changed the config to this:

// SASS/SCSS
// ===========================================
gulp.task('sass:build', function () {
  return gulp.src(path.build.sass)
    .pipe(sourcemaps.init())
    .pipe(sass().on("error", notify.onError()))
    .pipe(autoprefixer(['last 20 versions', '> 1%', 'ie > 8']))
    .pipe(rename(function (path) {
      path.extname = ".css"
    }))
    .pipe(sourcemaps.write('/maps'))
    .pipe(gulp.dest(path.build.cssPath))
    .pipe(cleanCSS())
    .pipe(sourcemaps.write('/maps'))
    .pipe(rename(function (path) {
      path.extname = ".min.css"
    }))
    .pipe(gulp.dest(path.build.cssPath))
    .pipe(reload({stream: true}));
});

As a result, a maps folder is created in the CSS folder, but in addition to map files, it contains duplicate css files and another subfolder maps is created.
5bf39ad6b5bfd817709180.png5bf39ae13145f713672951.png
Is it possible to edit the config so that .maps are created next to css files?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question