Alex
Alex

Reputation: 2062

Gulp - compiled css file not generated in directory I want

Im using gulp 3.9.1 to compile scss. It compiles fine, but the not outputting the compiled css in the dest directory. Here's my gulpfile.js:

var gulp = require('gulp');
var sass = require("gulp-sass");

gulp.task('sass', function() {
    return gulp.src("/scss/*.scss").pipe(sass()).pipe(gulp.dest("./css"));
});

Instead, the compiled css being generated in the same folder as the source scss file. Whats my mistake?

The structure of my folders is as follows:

-root
     -css (the desired destination of the compiled css)
     -node_module
     -scss
         -style.scss
         -style.css (should'nt be here!!)
     -gulpfile.js

Upvotes: 1

Views: 1032

Answers (1)

Alexander Solovyev
Alexander Solovyev

Reputation: 581

You should set the destination folder as 'css' instead of './css'. I have just tested and it is working for me like you expected:

var gulp = require('gulp');
var sass = require("gulp-sass");

gulp.task('sass', function() {
    return gulp.src("/scss/*.scss").pipe(sass()).pipe(gulp.dest("css"));
});

Upvotes: 1

Related Questions