An issue with a Gulpfile made me stuck in one point of a webdesigner course which consists of prerecorded tutorials. I tried to recreate steps from a video about making a gulpfile.js:
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
var cssDest = 'style';
var cssInputFile = 'source/style.scss';
gulp.task('buildcss', function () {
return gulp.src(cssInputFile)
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(gulp.dest(cssDest));
})
The output of initialiing the task buildcss should be a CSS compiled from Sass, but instead it returns:
The following tasks did not complete: buildcss Did you forget to signal async completion?
Here’s package.json:
{
"devDependencies": {
"gulp": "^5.0.0",
"gulp-sass": "^5.1.0",
"sass": "^1.77.2"
},
"name": "moj-projekt",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"ansi-regex": "^5.0.1",
"ansi-styles": "^4.3.0",
"anymatch": "^3.1.3",
"array-each": "^1.0.1",
"array-slice": "^1.1.0",
"async-done": "^2.0.0",
"async-settle": "^2.0.0",
"bach": "^2.0.1",
"bare-events": "^2.2.2",
"base64-js": "^1.5.1",
"binary-extensions": "^2.3.0",
"bl": "^5.1.0",
"braces": "^3.0.3",
"buffer": "^6.0.3",
"chalk": "^4.1.2",
"chokidar": "^3.6.0",
"cliui": "^7.0.4",
"clone": "^2.1.2",
"clone-stats": "^1.0.0",
"color-convert": "^2.0.1",
"color-name": "^1.1.4",
"convert-source-map": "^2.0.0",
"copy-props": "^4.0.0",
"detect-file": "^1.0.0",
"each-props": "^3.0.0",
"emoji-regex": "^8.0.0",
"end-of-stream": "^1.4.4",
"escalade": "^3.1.2",
"expand-tilde": "^2.0.2",
"extend": "^3.0.2",
"fast-fifo": "^1.3.2",
"fast-levenshtein": "^3.0.0",
"fastest-levenshtein": "^1.0.16",
"fastq": "^1.17.1",
"fill-range": "^7.1.1",
"findup-sync": "^5.0.0",
"fined": "^2.0.0",
"flagged-respawn": "^2.0.0",
"for-in": "^1.0.2",
"for-own": "^1.0.0",
"fs-mkdirp-stream": "^2.0.1",
"function-bind": "^1.1.2",
"get-caller-file": "^2.0.5",
"glob-parent": "^5.1.2",
"glob-stream": "^8.0.2",
"glob-watcher": "^6.0.0",
"global-modules": "^1.0.0",
"global-prefix": "^1.0.2",
"glogg": "^2.2.0",
"graceful-fs": "^4.2.11",
"gulp-cli": "^3.0.0",
"gulplog": "^2.2.0",
"has-flag": "^4.0.0",
"hasown": "^2.0.2",
"homedir-polyfill": "^1.0.3",
"iconv-lite": "^0.6.3",
"ieee754": "^1.2.1",
"inherits": "^2.0.4",
"ini": "^1.3.8",
"interpret": "^3.1.1",
"is-absolute": "^1.0.0",
"is-binary-path": "^2.1.0",
"is-core-module": "^2.13.1",
"is-extglob": "^2.1.1",
"is-fullwidth-code-point": "^3.0.0",
"is-glob": "^4.0.3",
"is-negated-glob": "^1.0.0",
"is-number": "^7.0.0",
"is-plain-object": "^5.0.0",
"is-relative": "^1.0.0",
"is-unc-path": "^1.0.0",
"is-valid-glob": "^1.0.0",
"is-windows": "^1.0.2",
"isexe": "^2.0.0",
"isobject": "^3.0.1",
"last-run": "^2.0.0",
"lead": "^4.0.0",
"liftoff": "^5.0.0",
"map-cache": "^0.2.2",
"micromatch": "^4.0.7",
"mute-stdout": "^2.0.0",
"normalize-path": "^3.0.0",
"now-and-later": "^3.0.0",
"object.defaults": "^1.1.0",
"object.pick": "^1.3.0",
"once": "^1.4.0",
"parse-filepath": "^1.0.2",
"parse-passwd": "^1.0.0",
"path-parse": "^1.0.7",
"path-root": "^0.1.1",
"path-root-regex": "^0.1.2",
"picomatch": "^2.3.1",
"queue-tick": "^1.0.1",
"readable-stream": "^3.6.2",
"readdirp": "^3.6.0",
"rechoir": "^0.8.0",
"remove-trailing-separator": "^1.1.0",
"replace-ext": "^2.0.0",
"replace-homedir": "^2.0.0",
"require-directory": "^2.1.1",
"resolve": "^1.22.8",
"resolve-dir": "^1.0.1",
"resolve-options": "^2.0.0",
"reusify": "^1.0.4",
"safe-buffer": "^5.2.1",
"safer-buffer": "^2.1.2",
"semver": "^6.3.1",
"semver-greatest-satisfied-range": "^2.0.0",
"sparkles": "^2.1.0",
"stream-composer": "^1.0.2",
"stream-exhaust": "^1.0.2",
"streamx": "^2.16.1",
"string_decoder": "^1.3.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1",
"supports-color": "^7.2.0",
"supports-preserve-symlinks-flag": "^1.0.0",
"sver": "^1.8.4",
"teex": "^1.0.1",
"to-regex-range": "^5.0.1",
"to-through": "^3.0.0",
"unc-path-regex": "^0.1.2",
"undertaker": "^2.0.0",
"undertaker-registry": "^2.0.0",
"util-deprecate": "^1.0.2",
"v8flags": "^4.0.1",
"value-or-function": "^4.0.0",
"vinyl": "^3.0.0",
"vinyl-contents": "^2.0.0",
"vinyl-fs": "^4.0.0",
"vinyl-sourcemap": "^2.0.0",
"which": "^1.3.1",
"wrap-ansi": "^7.0.0",
"wrappy": "^1.0.2",
"y18n": "^5.0.8",
"yargs": "^16.2.0",
"yargs-parser": "^20.2.9"
},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"description": ""
}
As far as I am concerned, you can’t use synchronous tasks in latest version of Gulp and only async tasks are handled. Of course, adding an ‘async’ before a word function doesn’t help: it runs a task, but doesn’t compile a Sass file.
Many Hulp beginners would have similar problems and an answer to my question would help them. Until this,I can only blame my course provider for not keeping the learning material up-to-date.