Y
Y
Yura Komarov2020-07-02 09:34:48
gulp.js
Yura Komarov, 2020-07-02 09:34:48

How to tell gulp to only collect one stylesheet?

Hello.
I have been using the gulp collector for a long time, but then the question arose, is it possible for gulp to say that from all the style files that are given to it as input .src, it collects only those that have changed?
I have my own file with styles for each page, and when changing one, for some reason, everything is rebuilt. How to avoid it?
My css config

gulp
        .src('front/styles/*.styl')
        .pipe(plumber({errorHandler: errorHandler('Error in "styles" task')}))
        .pipe(gulpIf(isDebug, sourcemaps.init()))
        .pipe(
            stylus({
                use: [importIfExist(), autoprefixer()],
                'include css': true,
                define: {
                    // dev-mode variable for using in stylus
                    __DEV__: isDebug
                }
            })
        )
        .pipe(gulpIf(!isDebug, gcmq()))
        .pipe(gulpIf(!isDebug, nano({zindex: false, minifyFontValues: false, discardUnused: false})))
        .pipe(rename({suffix: '.min'}))
        .pipe(gulpIf(isDebug, sourcemaps.write()))
        .pipe(gulp.dest('public/assets/css'));

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