GULP – installing and use on Windows

Install Gulp

Installation of Gulp on Windows is somewhat … peculiar.
You have to install Gulp globally first, just to simulate symlink in PATH.
Without that symlink, you cannot access Gulp in your console.
You cannot add to PATH, as before you install Gulp, because you have nothing to add to PATH … and after installing Gulp globally, there is no reason to add Gulp to PATH, because it is global.
Madness 😉

Then, you have to install Gulp again (!) locally.
Just use console to go into dir you want to install local Gulp into and use this:

Plugins for concatenation:

If you get this error:

… try this syntax:

Gulpfile or gulp location problem:

If you install gulp in e.g. vendor folder – your node_modules end up in vendor/ – your gulpfile.js must be in same folder and your console should be in that folder as well (cd vendor\) to execute gulp command.

Error: SyntaxError: Unexpected token function

This means you have old Node,js – update here.
Problem is most likely with asynch functions – not supported by Node prior to version 7.6 .
More: here.

 

Run Gulp:

Define files to be concatenated and minified to gulpfile.js

Open console in folder where you have gulpfile.js, e.g. (!!): 

more than one function (!!):

run just one private function:

run default function, if you have just one defined:

 

Gulp file

 

 

A bit more reading on StackOverflow:

https://stackoverflow.com/q/39195128/436443

https://stackoverflow.com/a/34389980/436443

https://stackoverflow.com/a/28503814/436443

https://stackoverflow.com/a/34574537/436443

More about prerequisites for installation:

https://gulpjs.com/docs/en/getting-started/quick-start/

Interesting hands-on reading:

https://css-tricks.com/gulp-for-beginners/#cleaning-up-generated-files-automatically

Or even better ‘eyes-on’ watching 😉

https://www.youtube.com/watch?v=ssG5mziTF3E