dlmanning / gulp-sass

SASS plugin for gulp
MIT License
1.57k stars 381 forks source link

Paths inside destination css files building relates to the source sass folder #760

Closed Scorpovi4 closed 4 years ago

Scorpovi4 commented 4 years ago

After I've changed build structure to the below, paths (background) inside destination css files became build from folder where source sass files lay.

inside scss before convertation : background: url('../images/index/first-bg-desktop.jpg') top left/100% no-repeat;

inside css after:
background: url(../../scss/images/index/first-bg-desktop.jpg) 0 0/100% no-repeat;

   gulp.src($.srcAssets + 'scss/_pages/**/*', { since: gulp.lastRun('sass') })
      .pipe(newer($.distCss))
      .pipe(
          flatmap(function(stream, file) {
          let basename = path.basename(file.path, '.scss');
          return streamqueue(
            { objectMode: true },
            ... ,
            gulp
              .src([$.srcAssets + 'scss/style.scss'])
              .pipe(
                plumber({
                  errorHandler: notify.onError('Error: <%= error.message %>')
                })
              )
              .pipe(sass()),

            gulp
              .src([file.path])
              .pipe(
                plumber({
                  errorHandler: notify.onError('Error: <%= error.message %>')
                })
              )
              .pipe(sass())
          )
          ...
        }))
            .pipe(concatCss(basename + '.css'))
            .pipe(gcmq())
            .pipe(postcss(plugins))
            .pipe(gulp.dest($.distCss));
Scorpovi4 commented 4 years ago

Issue was in gulp-concate-css which I used to concate css. It replaced paths inside destination css for some reason... Replaced this plugin for gulp-concate and issue has been resolved.