code everywhere

creating build versions with gulp.js

posted on May 27, 2016, 11:03 pm in

Working with a CI (continuous integration) environment, you probably have multiple builds going out each day. This makes it hard to keep track of what version your actually using.

Lets add some build numbers using .

In your gulpFile.js, add this new section changing the version as appropriate.

var = new Date();
version '1.0.1';
build = [ n.getFullYear()-2000, (n.getMonth()+10) ? ''n.getMonth()+1, (n.getDate()<10) ? ''n.getDate(), '-'n.getHours(), (n.getMinutes() < 10) ? ''n.getMinutes()].join('');

then in the gulp build process:

pipe(replace('Version X (Build YYMMDD-HHMM)''Version ' version ' (Build ' build ')'))    

In your JS file, any mention of:

var build "Version X (Build YYMMDD-HHMM)";

will be convert to

var build "Version 1.0.1 (Build 160927-1834)";
giving you a trackable date/time for the current build your looking at.

recent posts

< back
find something helpful? send us some coin BTC 19u6CWTxH4cH9V2yTfAemA7gmmh7rANgiv

(ad) Need Hosting? Try Linode, VPS Starting from $5

privacy policy