N
N
narem2019-09-30 11:00:50
Node.js
narem, 2019-09-30 11:00:50

How to generate css(scss) in gulp?

const gulp = require('gulp'),
  sass = require('gulp-sass'),
  autoprefixer = require('gulp-autoprefixer'),
  cssnano = require('gulp-cssnano');

gulp.task('scss', () => {
  return gulp
  .src('dec/scss/**/*.scss')
  .pipe(sass())
  .pipe(
    autoprefixer(['last 15 version', '> 1%', 'ie 8', 'ie 7'], {
      cascade: true
    })
  )
  .pipe(cssnano())
  .pipe(gulp.dest('dist/css'));
});

gulp.task('default', gulp.series('scss'), () => {
  gulp.watch('dev/sass/**/*.scss', ['scss']);
});

I enter gulp , it gives the answer
[10:56:39] Using gulpfile /var/www/html/gulpfile.js
[10:56:39] Starting 'default'...
[10:56:39] Starting 'scss'...
[10: 56:39] Finished 'scss' after 32 ms
[10:56:39] Finished 'default' after 38 ms

But the css file doesn't appear in the folder, the main.scss file is in /dev/scss

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrej Sharapov, 2019-09-30
@Madeas

you have
.src(' dec /scss/**/*.scss')
and you write
main.scss file is in / dev /scss

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question