0

I'm trying to use gulp and gulp-sass to compile bower components in my project. I am using Windows 8.

The problem Im having is that gulp-sass seems not to be working. Or at least not giving me the result of the compilation. The weird thing about it is, that I dont even get error messages or something.

I just dont get any result whatsoever in my output directory.

The gulpfile.js:

"use strict";

var gulp = require("gulp"),
    sass = require("gulp-sass"),
    bowerFiles = require("main-bower-files"),
    gulpFilter = require("gulp-filter"),
    concat = require("gulp-concat");


gulp.task("bower", function () {
    var cssFilter = gulpFilter(["**/*.css", "**/*.scss"]);

    return gulp.src(bowerFiles())
        .pipe(cssFilter)
        .pipe(sass())
        .pipe(concat("bower.css"))
        .pipe(gulp.dest("wwwroot"))
        .pipe(cssFilter.restore());
});

I have tried several things until now:

I have tried to compile via commandline with the command

sass --trace bower_components\bootstrap-sass-pfficial\assets\stylesheets\_bootstrap.scss:wwwroot\bower.css

this worked and i got the expected result. Therefore i assume the sass installation works fine.

Another thing i tried is, I removed the ".pipe(sass())" line from the code above to just concat and copy the files. That worked.

And the third test was, not to use the main-bower-files to get the files but use a fixed path with sass:

gulp.src("bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap.scss")

But that didnt work either. Again no result.

I am using the following dependencies:

"dependencies": {
    "gulp": "^3.6.0",
    "gulp-sass": "^1.3.3",
    "main-bower-files": "^2.6.2",
    "gulp-filter": "^2.0.2",
    "gulp-concat": "^2.5.2"
}
fbrthld
  • 76
  • 1
  • 8
  • What happens when you remove all the other plugins, and just `gulp-src` that single file and `gulp-dest` it to `wwwroot` ? – Nick Tomlin Mar 15 '15 at 13:31
  • @NickTomlin that just copies as expected as well `gulp.src("bower_components/bootstrap-sass-official/assets/stylesheets/_bootstrap.scss") .pipe(gulp.dest("wwwroot"));` – fbrthld Mar 15 '15 at 13:40
  • So you are saying that that worked, correct? My guess is that this is something with `gulp-filter`. I personally prefer to just rely on gulp's built in globbing and have individual tasks for each type of asset, instead of trying to do them all in one task. – Nick Tomlin Mar 15 '15 at 14:15
  • @NickTomlin yeah the code i posted worked. but as soon as i try to compile the scss via `.pipe(sass())` it stops working. i dont get any output file then. – fbrthld Mar 15 '15 at 14:19

1 Answers1

0

Finally I found the problem. gulp-sass introduced in version 1.3.1 a check to filter partials by checking for "_" at the beginning of the file (https://github.com/dlmanning/gulp-sass/commit/3fface49e956297bbd707ce4e148f7e727675417). Because of that it doesnt compile the _bootstrap.scss

fbrthld
  • 76
  • 1
  • 8