2015-10-06 6 views
7

Sto cercando di compilare sass utilizzando gulp-ruby-sass ma sto ricevendo TypeError: glob pattern string required.TypeError: stringa modello glob richiesta

Questo è ciò che il mio gulpfile.js assomiglia:

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

Qui è la mia struttura di cartelle:

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

Sono nuovo e fresco per Gulp e non ho usato Grunt sia così mi scusi se ho fatto un errore banale

+0

nel mio caso, anche dopo l'esecuzione del sass direttamente, anche questo sassDestPath: ['build/css /'] genera errore "Errore: cartella di output non valida" quindi lo cambio in 'build/css /' e questo risolve il problema –

risposta

14

Guardando il docs, non sembra come si suppone di tubo nel gulp-ruby-sass, ma piuttosto lo chiamano direttamente in quel modo:

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

Grazie mille, ho guardato il video tutorial dove gulp-ruby- sass è stato usato nel modo in cui l'ho usato così non ho nemmeno guardato i documenti ufficiali. – msmolcic