S
S
Sergey2022-01-20 12:50:40
Sass
Sergey, 2022-01-20 12:50:40

How to properly include gulp-sass?

I connect gulp-sass 5.1.0 as in the documentation:

const sass = require('gulp-sass')(require('sass'));

I create a task for styles:
const styles = () => {
  return src('./src/scss/**/*.scss')
  .pipe(sass.sync().on('error', sass.logError))
  .pipe(gulp.dest('./css'))
  .pipe(gulpif(!isProd, sourcemaps.init()))
  .pipe(concat('main.css'))
  .pipe(autoprefixer({
    cascade: false
  }))
  .pipe(cleancss({
    level: 2
  }))
  .pipe(gulpif(!isProd, sourcemaps.write()))
  .pipe(dest('dist/styles'))
  .pipe(browserSync.stream())
}

I get the error:
[12:30:58] 'styles' errored after 2.21 ms
[12:30:58] ReferenceError: gulp is not defined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2022-01-20
@Summersby

ReferenceError: gulp is not defined

There gulp-sassare no errors.
Clue

.pipe(gulp.dest('./css'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question