G
G
Georg772021-07-03 10:14:18
Sass
Georg77, 2021-07-03 10:14:18

Gulp not compiling scss code to dist folder in VSCode?

Please tell me what is wrong, why does the terminal give an error?
1. There is a package.json file:

{
  "name": "gulp-scss-init",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "npx gulp watch"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^8.0.0",
    "gulp-sass": "^5.0.0",
    "node-sass": "^6.0.1"
  }
}

2. There is gulpfile.js :
const { task, src, watch, dest } = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const sass = require('gulp-sass');

sass.compiler = require('node-sass');

function scss() {
    return src('src/scss/**/*.scss')
        .pipe(sass.sync().on('error', sass.logError))
        .pipe(autoprefixer())
        .pipe(dest('dist/css'))
}

task('watch', () => {
    watch('src/scss/**/*.scss', scss);
});


3. Here is the project structure 60e00ca83c9fc016395774.png

Why does not compile the style.scss file into the dist folder and does not create the style.css file

In the terminal it gives the following error:
TypeError: sass.sync is not a function
    at scss (C:\Users\yuriy\Desktop\EASY CODE\WEEK7\Учебная\Gulp-Scss-Init\gulpfile.js:9:20)
    at bound (domain.js:416:15)
    at runBound (domain.js:427:12)
    at asyncRunner (C:\Users\yuriy\Desktop\EASY CODE\WEEK7\Учебная\Gulp-Scss-Init\node_modules\async-done\index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-07-03
@Georg77

Read .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question