I use sass (triggered by a gulp task) to generate my css files. I recently formatted my computed and this task stopped working.
var sass = require('gulp-ruby-sass');
var config = require('../config');
gulp.task('styles', ['copy'], function() {
gulp.src(config.sources.sass)
.pipe(sass({ style: config.isProduction ? 'compressed' : 'expanded' }))
.pipe(gulp.dest(config.build.cssDir));
});
This task used to work fine before I reinstalled my OS (Windows 8.1). Now after I run this task there is no visible errors, but no css files are created.
So, the question is:
Why did my gulp task stopped generating my css files?
Your gulp task is fine.
gulp-ruby-sass
uses, by default, the gem sass to compile your scss files. Since you recently formatted your computer I bet you installed the last version of Ruby Installer for Windows. I made some tests and I noticed that sass doesn’t seem to work on Windows while using Ruby 2.2.2. The sass gem works just fine on Ruby 2.2 on Ubuntu and OS X.
If that’s an option, I suggest that you downgrade from Ruby 2.2.x to Ruby 2.1.6 and that should fix your problem.
In case it doesn’t you could use gulp-debug to check your stream and start from there.
gulp.task('styles', ['copy'], function() {
gulp.src(config.sources.sass)
.pipe(debug({title: 'Before sass:'}))
.pipe(sass({ style: config.isProduction ? 'compressed' : 'expanded' }))
.pipe(debug({title: 'After sass:'}))
.pipe(gulp.dest(config.build.cssDir));
});
If you can't downgrade your ruby version, you could use gulp-sass
instead of gulp-ruby-sass
. Gulp sass doesn't require ruby at all, as it uses a wrapper made in node for a C/C++ library - libsass
.
You could also edit your post and include your gulp-ruby-sass
version (or your package.json
) and also your nodejs version.