javascript - gulp-ruby-sass Error: must provide pattern -
this directory structure:
i set workstation, , set gulp file work on folder format, not working properly.
this gulp file:
var gulp = require('gulp'), sass = require('gulp-ruby-sass'), imagemin = require('gulp-imagemin'), changed = require('gulp-changed'), browsersync = require('browser-sync'), livereload = require('gulp-livereload'), gp_concat = require('gulp-concat'), gp_rename = require('gulp-rename'), gp_uglify = require('gulp-uglify'), watch = require('gulp-watch'); gulp.task('sass', function () { gulp.src('./app/template/css/style_v1.scss') .pipe(sass()) .on('error', function (err) { console.log(err.message); }) .pipe(gulp.dest('./dist/css')) .pipe(livereload()); }); gulp.task('compress', function() { gulp.src('./app/*.js') .pipe(gp_concat('concat.js')) .pipe(gulp.dest('dist')) .pipe(gp_rename('script.min.js')) .pipe(gp_uglify()) .pipe(gulp.dest('./dist/js')); }); gulp.task('jpg', function() { gulp.src('./template/img/**/*.*') .pipe(changed('./dist/img/')) .pipe(imagemin({ progressive: true })) .pipe(gulp.dest('./dist/img/')); }); gulp.task('browser-sync', function() { browsersync.init(['./dist/css/**', 'index.php'], { server: { basedir: './', index: 'index.php' } }); }); gulp.task('watch', ['sass', 'browser-sync','compress'], function () { return watch('./app/template/css/style_v1.scss', function () { gulp.src('./app/template/css/style_v1.scss') .pipe(gulp.dest('build')); }); });
when run gulp watch
returns this:
(node:6668) fs: re-evaluating native module sources not supported. if using graceful-fs module, please update more recent version. [08:42:23] using gulpfile /var/www/html/evandro/sistema_metas/gulpfile.js [08:42:23] starting 'sass'... [08:42:23] 'sass' errored after 7.09 ms [08:42:23] error: must provide pattern
what problem?
i have code, css watch not work, watch html, can be?
gulp-ruby-sass
works differently other gulp plugins. don't pass .pipe()
. if take @ the documentation says following:
use gulp-ruby-sass instead of
gulp.src
compile sass files.
that means have use this:
var sass = require('gulp-ruby-sass'); gulp.task('sass', function () { return sass('./app/template/css/style_v1.scss') .on('error', function (err) { console.log(err.message); }) .pipe(gulp.dest('./dist/css')) .pipe(livereload()); });
alternatively can use gulp-sass
plugin instead of gulp-ruby-sass
. doesn't use ruby implementation of sass, rather c implementation (libsass). allows use .pipe()
other gulp plugins:
var sass = require('gulp-sass'); gulp.task('sass', function () { return gulp.src('./app/template/css/style_v1.scss') .pipe(sass()) .on('error', function (err) { console.log(err.message); }) .pipe(gulp.dest('./dist/css')) .pipe(livereload()); });
Comments
Post a Comment