Skip to content

Commit

Permalink
Upgrade gulp and build latest
Browse files Browse the repository at this point in the history
  • Loading branch information
stuyam committed Jan 13, 2020
1 parent 7606bb9 commit 49dde30
Show file tree
Hide file tree
Showing 5 changed files with 2,539 additions and 972 deletions.
13 changes: 6 additions & 7 deletions dist/openpixel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Open Pixel v1.0.5 | Published By Dockwa | Created By Stuart Yamartino | MIT License
// Open Pixel v1.1.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License
;(function(window, document, pixelFunc, pixelFuncName, pixelEndpoint, versionNumber) {
"use strict";

Expand All @@ -12,9 +12,8 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat

var Config = {
id: '',
version: versionNumber // check if a variable is not undefined, null, or blank

};
version: versionNumber
}; // check if a variable is not undefined, null, or blank

var isset = function isset(variable) {
return typeof variable !== 'undefined' && variable !== null && variable !== '';
Expand Down Expand Up @@ -90,7 +89,7 @@ var Cookie = {
expires = "; expires=" + date.toGMTString();
}

document.cookie = this.prefix() + name + "=" + value + expires + "; path=" + path;
document.cookie = this.prefix() + name + "=" + value + expires + "; path=" + path + "; SameSite=Lax";
},
get: function get(name) {
var name = this.prefix() + name + "=";
Expand All @@ -108,7 +107,7 @@ var Cookie = {

return;
},
delete: function _delete(name) {
"delete": function _delete(name) {
this.set(name, "", -100);
},
exists: function exists(name) {
Expand Down Expand Up @@ -281,7 +280,7 @@ function () {
utm_content: function utm_content(key) {
return Cookie.getUtm(key);
},
// get the utm concent
// get the utm content
utm_campaign: function utm_campaign(key) {
return Cookie.getUtm(key);
} // get the utm campaign
Expand Down
4 changes: 2 additions & 2 deletions dist/openpixel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 17 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ---------- Configurations for your custom build of open pixel ---------- //

// This is the header comment that will be included at the top of the "dist/openpixel.js" file
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.0.5 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.1.0 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';

// This is where the compiled snippet and openpixel.js files will be dropped
var DESTINATION_FOLDER = process.env.OPIX_DESTINATION_FOLDER || './dist';
Expand Down Expand Up @@ -31,8 +31,8 @@ var uglify = require('gulp-uglify');
var babel = require('gulp-babel');

// ---- Compile openpixel.js and openpixel.min.js files ---- //
gulp.task('openpixel', function() {
gulp.src([
function openpixel() {
return gulp.src([
'./src/config.js',
'./src/helpers.js',
'./src/browser.js',
Expand All @@ -56,12 +56,11 @@ gulp.task('openpixel', function() {
.pipe(inject.prepend(HEADER_COMMENT))
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(DESTINATION_FOLDER));
});

}

// ---- Compile snippet.html file ---- //
gulp.task('snippet', function() {
gulp.src('./src/snippet.js')
function snippet() {
return gulp.src('./src/snippet.js')
.pipe(inject.replace('js_url', JS_ENDPOINT))
.pipe(inject.replace('opix_func', PIXEL_FUNC_NAME))
// This will minify and rename to pressure.min.js
Expand All @@ -70,14 +69,18 @@ gulp.task('snippet', function() {
.pipe(inject.append('\n</script>\n<!-- End Open Pixel Snippet -->'))
.pipe(rename({ extname: '.html' }))
.pipe(gulp.dest(DESTINATION_FOLDER));
});
}

// watch files and run gulp
gulp.task('watch', function() {
gulp.watch('src/*', ['openpixel', 'snippet']);
});
function watch() {
gulp.watch('src/*', openpixel);
gulp.watch('src/*', snippet);
}

// run all tasks once
gulp.task('default', function() {
gulp.start('openpixel', 'snippet');
});
var build = gulp.parallel(openpixel, snippet);

exports.openpixel = openpixel;
exports.snippet = snippet;
exports.watch = watch;
exports.build = build;
Loading

0 comments on commit 49dde30

Please sign in to comment.