ReferenceError: Cannot access ‘devBuild’ before initialization
at Object. (C:\Users\riadk\Desktop\projectsamle\gulpfile.js:11:16)
Does anyone have an idea what is happening here and why this is broken. I cannot figure out why a tutorial from Sitepoint would give broken code…
Here is the full cli call:
riadk@RIADS-LAPTOP MINGW64 ~/Desktop/projectsample/src (master)
$ gulp css
[02:36:04] Working directory changed to ~\Desktop\projectsample
stripdebug = devBuild ? null : require('gulp-strip-debug'),
ReferenceError: Cannot access 'devBuild' before initialization
at Object.<anonymous> (C:\Users\riadk\Desktop\projectsample\gulpfile.js:11:16)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at execute (C:\Users\riadk\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:36:18)
at Liftoff.handleArguments (C:\Users\riadk\AppData\Roaming\npm\node_modules\gulp-cli\index.js:201:24)
at Liftoff.execute (C:\Users\riadk\AppData\Roaming\npm\node_modules\gulp-cli\node_modules\liftoff\index.js:201:12)
I’m also getting a lot of errors following this tutorial. When you suggest amendments can you ask the author to note the node and npm versions they are using. And, as a bonus it would be helpful to have the complete gulpfile.js attached at the end of the tutorial to make sure nothing is missed out.
That works, although it does throw errors for autoprefixer (already flagged above).
I’m confused with the goal of An Introduction to Gulp.js, I was expecting to step through adding browser-sync and creating a gulp watch command. My goal was to setup a gulp project where I could edit html, js, scss and see changes replicated in a live environment.
Actually, thinking about it, this npm package may be better suited to your needs.
You’d still need some way of compiling SCSS to CSS, but you could do this with Webpack or with Gulp.
You would install live-server on your machine globally, then use it to serve your site. Simultaneously, you’d kick off your SCSS > CSS transpilation using a watch flag, so that it would recompile when you make any changes.
I’ve used Gulp in the past with browser-sync. I wanted to upgrade to v4 and migrate some existing projects over.
To confirm, the desired outcome for someone following the An Introduction to Gulp.js tutorial is to create a gulp file, do some setup, then move onto webpack. Is there somewhere where I can provide feedback on this?
Not really. If you have an old Gulp project running successfully with Browser sync, then I would upgrade that. From what you posted above, it sounded like you were new to using Gulp. My replies were just how I would go about tackling the problem you outlined.
You can leave a review on the book page, or you can post here. I can make sure that any feedback gets passed on.