Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp plugin gulp-ruby-sass not compiling

Gulp plugin gulp-ruby-sass(https://github.com/sindresorhus/gulp-ruby-sass) giving not compiling, the error message in terminal coming like this 👇

Error: must provide pattern

Here is the gulpfile.js details

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

    gulp.task('styles', function (argument) {
        gulp.src('sass/app.scss')
            .pipe(sass())
            .pipe(gulp.dest('css/'));
    });
like image 544
Mo. Avatar asked Oct 12 '15 14:10

Mo.


3 Answers

The gulp-ruby-sass syntax has been changed:

instead of:                          it is now:

gulp.task('styles', function (){     gulp.task('styles', function (){
    gulp.src('sass/app.scss')            return 
        .pipe(sass())                        sass('sass/app.scss')
        .pipe(gulp.dest('css/')              .pipe(gulp.dest('css/')
    ;                                    ;
});                                  }); 

Please check it out and mark your problem as solved.

like image 199
Guenther Avatar answered Nov 12 '22 00:11

Guenther


The official gulp-ruby-sass documentation says it should be done like this:

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

gulp.task('sass', function () {
  return sass('source/file.scss')
    .on('error', sass.logError)
    .pipe(gulp.dest('result'));
});
like image 6
ngstschr Avatar answered Nov 12 '22 00:11

ngstschr


Install libsass because it runs much faster than ruby sass , it works with node

npm install gulp-sass --save-dev`

Install gulp load plugins because it does so much and loads plugins from your json and you dont need to declare in your gulpfile (carefull how many you use because if you load too many it hinders performance)

npm install --save-dev gulp-load-plugins

 var gulp = require('gulp'),
      $ = require('gulp-load-plugins')({
        pattern: ['gulp-*', 'gulp.*'],
        replaceString: /\bgulp[\-.]/,
        lazy: true,
        camelize: true
      });

gulp.task('libsass', function () {
      gulp.src('sass/app.scss')
          .pipe($.sass({errLogToConsole: true}))
          .pipe($.autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
           }))
          .pipe($.sourcemaps.write('app/css/map'))
          .pipe(gulp.dest('app/css'))
  });
like image 2
Dragutescu Alexandru Avatar answered Nov 12 '22 00:11

Dragutescu Alexandru