[GULP] Gulp doesn't update CSS file

Hey,

I am new to Gulp and trying to set up. The problem is Gulp doesn’t update css file after I change .scss. It even doesn’t create a new one. Gulp output isn’t changing when I change default.css.

Gulpfile.js:

'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var changed = require('gulp-changed');

// SCSS/CSS

var SCSS_src='.src/Assets/scss/**/*.scss';
var SCSS_DEST = '.src/Assets/css';

gulp.task('compile_scss', function() {

gulp.src(SCSS_SRC)
.pipe(sass().on('error', sass.logError))
.pipe(minifyCSS())
.pipe(rename({ suffix: '.min' }))
.pipe(changed(SCSS_DEST))
.pipe(gulp.dest(SCSS_DEST));

});
// Detect changes in CSS

gulp.task('watch_scss', function() {
gulp.watch(SCSS_SRC, ['compile_scss']);
});

// Run tasks

gulp.task('default', ['watch_scss']);

Screens:

output.jpg

Hi @amurcheg,

Thanks for being part of the GitHub Community Forum! We’re glad you’re here.

I wanted to jump in here, and mention that if you don’t get the help you’re looking for from this particular community, you might want to try getting help somewhere that focuses on Gulp. It’s definitely possible another GitHub user might have run into this same issue and can help, but the GitHub Community Forum focuses primarily on topics related to GitHub itself or collaboration on project development and ideas. We want to make sure you’re getting the best support you can, but this forum may not be the right place for this particular topic.

Best of luck!

I did not test it myself, but looking at this line…

var SCSS_src='.src/Assets/scss/**/*.scss';

…it seems it is using a ** glob which matches any *.scss file inside one or more subdirectory levels, but not any files in the scss/ directory itself.

I think it would match your default.scss file if you just removed that glob like this:

var SCSS_src='.src/Assets/scss/*.scss';
1 Like