0

I'm pretty new to gulp, so I'm stumbling around a bit. I was fine up until the point I wanted to add sourcemaps to my project, now my gulp gets stuck after running the default task and doesn't seem like it will ever start my 'css' task. Since, I'm not getting an error (my gulp task is just stalling) I can't narrow down what's wrong with my file. Here's my gulpfile code and a picture of what's going on in my terminal. I've waited for a good 5 minutes for it to start 'css' and throw an error, but nothing is progressing.

As an edit note, I did change my sass files so that it would trigger the 'css' task to update my styles. I am still having the same issue where it is stuck after it runs the default task and does not start 'css'.

var gulp = require('gulp');
var minifycss = require('gulp-cssnano');
var autoprefixer = require('gulp-autoprefixer');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('css', function() {
  return sass('sass/**/*.scss')
    .pipe(sourcemaps.init())
    .pipe(autoprefixer())
    .pipe(concat('styles.css'))
    .on('error', sass.logError)
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('./css'))
        .pipe(notify({ message: 'Wait for it....wait for it!!!' }));
});

gulp.task('default', function() {
    gulp.watch('scss/**/*.scss',['css']);
});

terminal window

Kathryn Crawford
  • 611
  • 1
  • 10
  • 27
  • The default task you are using is just watching for changes in scss, so when you change something in a scss after running `gulp` it will start the css task. If you run `gulp css` directly the css task should start. – Fabio Felici Jan 15 '16 at 17:05
  • I should have added that I tested that. I changed the background image in my sass and then ran gulp and it did not update the css – Kathryn Crawford Jan 15 '16 at 17:09
  • You have to run `gulp` and then make changes! Or run directly `gulp css`. – Fabio Felici Jan 15 '16 at 17:13
  • Ohhh...I just understood what you guys are saying. Runs fine! I did have an error that I found on my own, I had my sass folder set to sass, when it's actually named scss. – Kathryn Crawford Jan 15 '16 at 17:21
  • Ok I'll try again! Run `gulp` and leave the terminal. Then go to a scss file change something and save. The terminal should output to you that css task is started. – Fabio Felici Jan 15 '16 at 17:21
  • Yep! I understand now. Like I said....I have no idea how gulp works, but I'm learning. Thanks guys! – Kathryn Crawford Jan 15 '16 at 17:22

0 Answers0