Recently, I've dived into the world of JavaScript, node.js, and related technologies. My goal is to create a front-end development environment from scratch using tools like gulp, bower, browser sync, and various plugins.
I've made significant progress in setting up the environment, but I'm facing some roadblocks that I can't seem to overcome. It could be due to issues with the code syntax, the execution order of functions in my gulpfile.js, or even incorrect usage of certain plugins. I've tried tweaking settings, changing paths, and experimenting with different configurations, but nothing seems to work.
Currently, I'm encountering the following challenges:
I have to save main.scss twice before seeing changes in the browser.
When running gulp in the console, I'm getting the following errors:
[16:38:08] Starting 'html'...
[16:38:08] 'html' errored after 41 ms
[16:38:08] ReferenceError: injectFiles is not defined at Gulp. ([full_path]\gulpfile.js:50:18)
at module.exports ([full_path]\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask ([full_path]\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep ([full_path]\node_modules\orchestrator\index.js:214:10)
at [full_path]\node_modules\orchestrator\index.js:279:18)
at finish ([full_path]\node_modules\orchestrator\lib\runTask.js:21:8)
at [full_path]\node_modules\orchestrator\lib\runTask.js:52:4
at f ([full_path]\node_modules\once\once.js:17:25)
at DestroyableTransform.onend ([full_path]\node_modules\end-of-stream\index.js:31:18)
at emitNone (events.js:91:20)
Reviewing my gulpfile.js content:
...
If you have any insights or suggestions on how to resolve these issues and optimize my environment setup, I'd greatly appreciate your guidance.
Update on the previous issue:
A recent breakthrough thanks to Bruno Poeta's advice:
Plumber encountered an unhandled error caused by 'gulp-sass plugin.' The error message indicated an @import loop in the main.scss file.
[15:11:19] gulp-inject successfully injected files into index.html.
[Browsersync] Access URLs:
Local: localhost : 3000
External: 192.168 .0.4 :3000
UI: localhost :3001
UI External: 192.168 .0.4 :3001
[Browsersync] Serving files from: dist
[Browsersync] Watching files...
Note: Line 526 mentioned in the error doesn't actually exist as it's generated by the gulp-inject plugin; marking the end of the injection process.