2015-10-06 25 views
7

gulp-ruby-sass'u kullanarak sass derlemeye çalışıyorum ancak TypeError: glob pattern string required alıyorum. İşte TypeError: glob pattern string required

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']); 

benim klasör yapısı şöyledir::

├── 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 

Yutkunuyorum yeni taze ve ben pardon ya bu kadar Grunt kullanmadıysanız

Bu gibi benim gulpfile.js benzediğini olduğunu önemsiz bir hata yaparsam. docs baktığımızda

+0

sonra bile bu, doğrudan küstahlığı çalıştırmak sassDestPath: ['build/css /'] hata üretir "Hata: Invalid output klasörü" bu yüzden 'build/css /' olarak değiştiririm ve bu sorunu çözer –

cevap

14

, bu gulp-ruby-sass içine boru zannediyorsunuz gibi görünebilir ancak daha ziyade böyle doğrudan çağırmaz:

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

Çok teşekkürler, gulp-ruby- nerede video eğitimi izledim sass kullanmış olduğum şekilde kullanıldı, böylece resmi belgelere bakmadım bile. – msmolcic