e.m.b e.m.b - 5 months ago 23x
Bash Question

How to make gulp tasks cross platform. Especially gulp-shell

I am trying to run some gulp tasks that contain some shell commands. It works perfectly in linux but when I switched to Windows, all the env variables are not accessible through de $var syntax (equivalent to %var% in windows). Do I need to create a specific gulpfile for windows platform or there's any other cleaner way ??


Fixed this by using the cross-env npm package !! Simply run :

npm i cross-env --save-dev

and then, add the cross-env before setting your environment vars, for example

cross-env mode=debug

And here's a link for the full documentation: https://www.npmjs.com/package/cross-env