forked from ei-technologies/nibs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
32 lines (28 loc) · 856 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var gulp = require('gulp');
var replace = require('gulp-replace-task');
var args = require('yargs').argv;
var fs = require('fs');
gulp.task('replace', function () {
// Get the environment from the command line
var env = args.env || process.env.ENV || 'dev';
console.log("environment: " + env);
// Read the settings from the right file
var filename = env + '.json';
var settings = JSON.parse(fs.readFileSync('./config/' + filename, 'utf8'));
// Replace each placeholder with the correct value for the variable.
gulp.src('./config/config.js')
.pipe(replace({
patterns: [
{
match: 'serverUrl',
replacement: settings.serverUrl
},
{
match: 'fbAppId',
replacement: settings.fbAppId
}
]
}))
.pipe(gulp.dest('client/js'))
.pipe(gulp.dest('nibs-shell/www/js'));
});