Y
Y
yura_born2020-04-20 14:52:16
gulp.js
yura_born, 2020-04-20 14:52:16

Why is gulp sass not updating css?

gulp.task('sass', function() { // Создаем таск Sass
    return gulp.src(['src/wp-content/themes/ninazvereva/sass/**/*.sass',
                    'src/wp-content/themes/ninazvereva/sass/**/*.scss']) // Берем источник
        .pipe(sass().on('error', sass.logError))
        .pipe(sass()) // Преобразуем Sass в CSS посредством gulp-sass
        .pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true })) // Создаем префиксы
        .pipe(gulp.dest('src/wp-content/themes/ninazvereva/css')) // Выгружаем результата в папку app/css
        .pipe(browserSync.reload({stream: true})) // Обновляем CSS на странице при изменении
});


gulp.task('watch', function() {
    gulp.watch(['src/wp-content/themes/ninazvereva/sass/**/*.sass','src/wp-content/themes/ninazvereva/sass/**/*.scss'], gulp.parallel('sass')); // Наблюдение за sass файлами в папке sass в теме
    gulp.watch('src/wp-content/themes/ninazvereva/**/*.php', gulp.parallel('code'));
    gulp.watch('src/wp-content/themes/ninazvereva/js/common.js', gulp.parallel('scripts')); // Наблюдение за главным JS файлом и за библиотеками
});


The first time I run gulp, the styles.css file is formed correctly and the page is displayed correctly, when I make changes to the styles.scss file, the sass task is processed, a message is displayed
[14:26:07] Starting 'sass'...
[Browsersync] 2 files changed (libs.css, styles.css)
[14:26:09] Finished 'sass' after 2.17 s

but in the styles.css file, no changes are made to what it was and remains.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-20
@Seasle

.pipe(browserSync.reload({stream: true})) // Обновляем CSS на странице при изменении
transfer this magic to a separate task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question