A
A
Azat S.2016-02-25 19:09:08
css
Azat S., 2016-02-25 19:09:08

How to add CSS src file in the middle of pipe in Gulp.js?

The task is to add a CSS file in the middle of the Gulp.js task.
It looks like this:

gulp.task('css', function () {
  var processors = [
    // список разных плагинов PostCSS
  ];
  return gulp.src('src/css/style.css') // подбираем style.css
    .pipe(postcss(processors)) // прогоняем по PostCSS плагинам
    .pipe(uncss({
        html: ['dist/index.html'] // удаляем селекторы, которые не нужны
    }))
  // А здесь ступор. Необходимо добавить другой CSS файл, который добавляет CSS
  // селекторы, которые добавляются с помощью Js и не могут быть обнаружены с
  // UnCSS
    .pipe(nano()) // после чего общий CSS минифицируется
    .pipe(gulp.dest('dist/css/'))
    .pipe(browserSync.stream());
});

Gulp-add-src from something doesn't work with CSS. files, .pipe(gulp.src('src/css/other.css')) doesn't help either.
How to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Azat S., 2016-02-25
@azat-io

Apparently, the only way out is to make a separate task

C
ChickenGrinder, 2016-03-03
@ChickenGrinder

Looks like you need a plugin https://github.com/urish/gulp-add-src

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question