Answer the question
In order to leave comments, you need to log in
Gulp throws an error?
Hello, please help me, I can’t understand why the error occurs installed nodejs via brew then installed
gulp npm install gulp -g
created the
mkdir project Gus
cd Gus
npm init
installed ruby and phyton via brew
saved the project npm install gulp --save-dev
installed the libraries npm install gulp -ruby-sass gulp-autoprefixer gulp-minify-css gulp-rename --save-dev
created gulpfile.js,
wrote this
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');
gulp.task('styles',
return gulp.src('sass/*.scss')
.pipe(sass({ style: 'expanded' }))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'))
.pipe(gulp.dest('css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest( 'css'));
});
created a sass folder and a style.scss file
wrote the following
$color: #eee;
#box {
color : $color;
box-sizing: border-box;
}
ran the following command:
gulp styles
throws an error
Gus user$ gulp styles
[02:57:00] Using gulpfile ~/Desktop/Site/Gus/gulpfile.js
[02:57:00] Starting 'styles'...
[02:57:00] TypeError: glob pattern string required
at new Minimatch (/Users/user/Desktop/Site/Gus/node_modules/minimatch/minimatch.js:116:11)
at setopts (/Users/user/Desktop/ Site/Gus/node_modules/glob/common.js:118:20)
at new GlobSync (/Users/user/Desktop/Site/Gus/node_modules/glob/sync.js:40:3)
at Function.globSync [as sync ] (/Users/user/Desktop/Site/Gus/node_modules/glob/sync.js:26:10)
at gulpRubySass (/Users/user/Desktop/Site/Gus/node_modules/gulp-ruby-sass/index.js :71:21)
at /Users/user/Desktop/Site/Gus/gulpfile.js:9:11
at taskWrapper (/Users/user/Desktop/Site/Gus/node_modules/undertaker/lib/set-task.js: 13:15)
at bound (domain.js:415:14)
at runBound (domain.js:428:12)
at asyncRunner(/Users/user/Desktop/Site/Gus/node_modules/async-done/index.js:55:18)
Answer the question
In order to leave comments, you need to log in
So bro look here yuzay!
const gulp = require('gulp'), // Подключаем Gulp
cleanCSS = require('gulp-clean-css'),
sass = require('gulp-sass'), // Подключаем Sass пакет
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'); // Подключаем библиотеку для объеденения файлов
let pathBuild = './dist/', pathSrc = './src/';
gulp.task('sass', function () {
return gulp.src(pathSrc + 'sass/**/*.+(sass|scss)')
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(autoprefixer({browsers: ['ie >= 9', 'last 2 version'], cascade: false}))
.pipe(cleanCSS({compatibility: 'ie9'}))
.pipe(gulp.dest(pathBuild + 'css'));
});
Check the autoprefixer, if I'm not mistaken, the list of browsers is written in an array
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question