9

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.

msmolcic
  • 6,407
  • 8
  • 32
  • 56
  • in my case even after run the sass directly, also this sassDestPath: ['build/css/'] generate error "Error: Invalid output folder" so I change it to 'build/css/' and that's fix the issue – Paweł Liszka Mar 04 '17 at 14:13

1 Answers1

18

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));
});
kombucha
  • 1,424
  • 1
  • 11
  • 19
  • 1
    Thanks a lot, I watched the video tutorial where gulp-ruby-sass was used the way I used it so I didn't even look at the official docs. – msmolcic Oct 06 '15 at 13:30