C
C
Cheizer2021-03-13 14:39:33
gulp.js
Cheizer, 2021-03-13 14:39:33

GULP how to remove duplicate lines in SCSS?

Greetings, help me solve the problem, I'm mastering GULP, everything works out, but I ran into a problem that I can't solve.

For example, there is such a style file, linter combed it, but for some reason duplicates appeared, I will still figure it out with the appearance of duplicates, it can be seen that he rebuilt the properties in order but does not delete the old ones, so far so good.
BUT how to remove duplicates now?

.blog-page3 .masonary {
  margin: auto;
  columns: 3;
  columns: 3;
  columns: 3;
  column-gap: 30px;
  column-gap: 30px;
  column-gap: 30px;
}


I found a kind of csso package https://github.com/ben-eb/gulp-csso

gulp js like this for me (removed the excess)

const gulp = require('gulp');
const { src, dest } = require('gulp');
const del = require("del");
const fileinclude = require("gulp-file-include");
const group_media = require("gulp-group-css-media-queries");
const rename = require("gulp-rename");
const sass = require('gulp-sass');
const server = require('browser-sync').create();
const postcss = require('gulp-postcss');
const svgSprite = require('gulp-svg-sprite');
const svgo = require('gulp-svgo');
const removeHtmlComments = require('gulp-remove-html-comments');
const replace = require('gulp-replace');
const csso = require('gulp-csso');  // ПОСЛЕ УСТАНОВКИ ПОДКЛЮЧИЛ


// styles
const styles = () => {
  return src(config.styles.src)
    .pipe(
      sass({
        outputStyle: "expanded"
      })
    )
    .pipe(
      group_media()
    )
    .pipe(postcss([
      require('autoprefixer'),
      require('postcss-discard-comments'),
      require('postcss-csso')
    ]))
    .pipe(csso())  // ДОБАВИЛ УДАЛЕНИЕ ДУБЛЕЙ
    .pipe(
      rename({
        extname: ".min.css"
      })
    )
    .pipe(dest(config.styles.dist))
    .pipe(server.stream());
}


I do gulp build, then npm run lint and duplicates are not removed, what am I doing wrong?

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