I’ve been meaning to get acquinted with a web development related task runner like Grunt, Gulp or Webpack for quite a while now. The only reason I’ve been able to “avoid” using them for this long is due to not doing web development fulltime.
What I wanted to achieve
I had already set up my (X)ubuntu machine for
nvm so getting started with Gulp was straight-forward.
I started by reading this article: https://markgoodyear.com/2014/01/getting-started-with-gulp/
- Install Gulp globally by
npm install gulp -g
- Open shell,
cdto project folder.
npm initif you had not done that yet.
npm install gulp gulp-uglify gulp-js-obfuscator --save-dev
As a sidenote, I actually tried multiple obfuscator modules from https://www.npmjs.com/browse/keyword/obfuscate before settling on
So here’s my first
gulpfile.js. No default task, nothing fancy, just tasks to
uglify (minify) and
obfuscate *.js files in the
src directory and place the output files in
To run the tasks, use
gulp uglify and
gulp obfuscate on the command line.
Next things to do
One of the next things would be to add
jshinting as well as a
gulp watch task and support for LiveReload. But I don’t need those at the moment.