diff --git a/gulpfile.js b/gulpfile.js
index 7b05b22ad06..92851bbc192 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -28,6 +28,7 @@ var gulpif = require('gulp-if');
var sourcemaps = require('gulp-sourcemaps');
var through = require('through2');
var fs = require('fs');
+var jsEscape = require('gulp-js-escape');
var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
@@ -296,10 +297,21 @@ gulp.task('e2etest-report', function() {
}, 5000);
});
-gulp.task('build-postbid', function() {
+// This task creates postbid.js. Postbid setup is different from prebid.js
+// More info can be found here http://prebid.org/overview/what-is-post-bid.html
+gulp.task('build-postbid', ['escape-postbid-config'], function() {
+ var fileContent = fs.readFileSync('./build/postbid/postbid-config.js', 'utf8');
+
return gulp.src('./integrationExamples/postbid/oas/postbid.js')
- .pipe(uglify())
- .pipe(gulp.dest('build/dist'));
+ .pipe(replace('\[%%postbid%%\]', fileContent))
+ .pipe(gulp.dest('build/postbid/'));
+});
+
+// Dependant task for building postbid. It escapes postbid-config file.
+gulp.task('escape-postbid-config', function() {
+ gulp.src('./integrationExamples/postbid/oas/postbid-config.js')
+ .pipe(jsEscape())
+ .pipe(gulp.dest('build/postbid/'));
});
module.exports = nodeBundle;
diff --git a/integrationExamples/postbid/oas/postbid-config.js b/integrationExamples/postbid/oas/postbid-config.js
new file mode 100644
index 00000000000..f251938bc9c
--- /dev/null
+++ b/integrationExamples/postbid/oas/postbid-config.js
@@ -0,0 +1,54 @@
+
+
\ No newline at end of file
diff --git a/integrationExamples/postbid/oas/postbid.js b/integrationExamples/postbid/oas/postbid.js
index a4aeb588b26..856f5f36207 100644
--- a/integrationExamples/postbid/oas/postbid.js
+++ b/integrationExamples/postbid/oas/postbid.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
(function(window){
var postbid = {};
postbid.que = [];
@@ -100,7 +101,22 @@
}
postbid.que.push(function(conf) {
- var content = "\n