gulpgulp-ruby-sass

TypeError: glob pattern string required


I'm trying to compile sass using gulp-ruby-sass but I'm getting TypeError: glob pattern string required.

This is what my gulpfile.js looks like:

var gulp = require('gulp'),
    sass = require('gulp-ruby-sass');

var paths = {
    sassSrcPath: ['Content/css/**/*.scss'],
    sassDestPath: ['build/css/'],
    sassImportsPath: ['Content/styleguide/']
};

// Styles Task
gulp.task('styles', function () {
    gulp.src(paths.sassSrcPath)
        .pipe(sass({
            style: 'compressed',
            loadPath: [paths.sassImportsPath]
        }))
        .pipe(gulp.dest(paths.sassDestPath));
});

// Watch Task
gulp.task('watch', function () {
    gulp.watch(paths.sassSrcPath, ['styles']);
});

gulp.task('default', ['styles', 'watch']);

Here is my folder structure:

├── Content
│   ├── css
│   │   ├── partials
│   │   │   └─_icons.scss
│   │   ├── main.css.scss
│   │   └── styleguide.css.scss
│   └── styleguide
│       ├── css
│       │   └─ vendor
│       │      └─ // Bunch of other folders that contain .sass files
│       └── // Other .sass files
└── gulpfile.js

I'm fresh new to Gulp and I haven't used Grunt either so excuse me if I made a trivial mistake.


Solution

  • Looking at the docs, it doesn't seem like you're supposed to pipe into gulp-ruby-sass, but rather call it directly like that :

    gulp.task('styles', function () {
        return sass(paths.sassSrcPath, {
                style: 'compressed',
                loadPath: [paths.sassImportsPath]
            })
            .pipe(gulp.dest(paths.sassDestPath));
    });