Skip to content

Commit

Permalink
fix deploy settings, update GA events tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
mtt87 committed Feb 28, 2017
1 parent c41598a commit 6b69dc6
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 52 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ dist
.sass-cache
bower_components
test/bower_components
awsConfig.json
.awspublish-th-splash
deployConfig.json
deployConfig.js

18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
example config `deployConfig.js`

```js
module.exports = {
staging: {
host: '123',
user: 'ubuntu',
keyLocation: '/Users/mattia/.ssh/xxx.pem',
remotePath: '/var/www/techhub.com/splash'
},
production: {
host: '123',
user: 'ubuntu',
keyLocation: '/Users/mattia/.ssh/id_rsa',
remotePath: '/var/www/techhub.com/splash'
}
}
```
8 changes: 7 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
exports.loadCSS = n : e.loadCSS = n
}("undefined" != typeof global ? global : this);
loadCSS('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');
var trackOutboundLink = function(url) {
ga('send', 'event', 'outbound', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){document.location = url;}
});
}
</script>
<!-- Place favicon.ico in the root directory -->

Expand Down Expand Up @@ -192,7 +198,7 @@ <h1 class="title title-home is-th-font">
The global community<span class="is-hidden-desktop">&nbsp;</span><br class="is-hidden-mobile">for technology startups
</h1>
<a href="#memberships" id="join-the-community" class="button is-home-cta is-medium">Join the Community</a>
<a href="https://www.techhub.com/events/" class="button is-home-cta is-medium">Attend an Event</a>
<a href="https://www.techhub.com/events/" onclick="trackOutboundLink('https://www.techhub.com/events/'); return false;" class="button is-home-cta is-medium">Attend an Event</a>
</div>
<div class="locations-button-mobile is-hidden-desktop" id="modal-locations-open">
Locations
Expand Down
14 changes: 13 additions & 1 deletion app/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
'use strict';

// link membership boxes
$('.full-bg-membership').click(function() {
$('.full-bg-flex').click(function() {
ga('send', 'event', 'main_flex', 'click');
window.open('https://apply.techhub.com');
});

$('.full-bg-resident').click(function() {
ga('send', 'event', 'main_resident', 'click');
window.open('https://apply.techhub.com');
});

$('.full-bg-team').click(function() {
ga('send', 'event', 'main_team', 'click');
window.open('https://apply.techhub.com');
});

Expand All @@ -11,6 +22,7 @@

// smooth scroll
$('#join-the-community').click(function() {
ga('send', 'event', 'join_community', 'click');
if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
Expand Down
55 changes: 8 additions & 47 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,7 @@ import s3Index from 'gulp-s3-index';
const $ = gulpLoadPlugins();
const reload = browserSync.reload;

const awsConfig = JSON.parse(fs.readFileSync('./awsConfig.json'));
const deployConfig = JSON.parse(fs.readFileSync('./deployConfig.json'));

const publisher = $.awspublish.create({
'params': {
'Bucket': 'th-splash',
},
'accessKeyId': awsConfig.key,
'secretAccessKey': awsConfig.secret,
});

const cloudfrontConfig = {
'accessKeyId': awsConfig.key,
'secretAccessKey': awsConfig.secret,
'distributionId': awsConfig.distributionId,
'bucket':'th-splash',
};
const deployConfig = require('./deployConfig');

gulp.task('styles', () => {
return gulp.src('app/styles/*.scss')
Expand Down Expand Up @@ -126,12 +110,11 @@ gulp.task('images', () => {
.pipe(gulp.dest('dist/images'));
});

gulp.task('fonts', () => {
return gulp.src(require('main-bower-files')('**/*.{eot,svg,ttf,woff,woff2}', function(err) {})
.concat('app/fonts/**/*'))
.pipe(gulp.dest('.tmp/fonts'))
.pipe(gulp.dest('dist/fonts'));
});
// gulp.task('fonts', () => {
// return gulp.src('app/fonts/**/*')
// .pipe(gulp.dest('.tmp/fonts'))
// .pipe(gulp.dest('dist/fonts'));
// });

gulp.task('videos', () => {
return gulp.src('app/videos/*.*')
Expand All @@ -149,7 +132,7 @@ gulp.task('extras', () => {

gulp.task('clean', del.bind(null, ['.tmp', 'dist']));

gulp.task('serve', ['styles', 'scripts', 'fonts'], () => {
gulp.task('serve', ['styles', 'scripts'], () => {
browserSync({
notify: false,
port: 9000,
Expand All @@ -165,13 +148,10 @@ gulp.task('serve', ['styles', 'scripts', 'fonts'], () => {
'app/*.html',
'.tmp/scripts/**/*.js',
'app/images/**/*',
'.tmp/fonts/**/*'
]).on('change', reload);

gulp.watch('app/styles/**/*.scss', ['styles']);
gulp.watch('app/scripts/**/*.js', ['scripts']);
gulp.watch('app/fonts/**/*', ['fonts']);
gulp.watch('bower.json', ['wiredep', 'fonts']);
});

gulp.task('serve:dist', () => {
Expand Down Expand Up @@ -203,25 +183,6 @@ gulp.task('serve:test', ['scripts'], () => {
gulp.watch('test/spec/**/*.js', ['lint:test']);
});

gulp.task('publish', () => {
// define custom headers
const headers = {
'Cache-Control': 'max-age=315360000, no-transform, public'
};

let revAll = new RevAll({ dontRenameFile: [/^\/favicon.ico$/g, 'robots.txt', 'apple-touch-icon.png'], });

return gulp.src('dist/**/*.*')
// .pipe(revAll.revision())
.pipe($.awspublish.gzip())
.pipe(publisher.publish(headers))
.pipe(publisher.sync())
.pipe(publisher.cache())
.pipe($.awspublish.reporter())
.pipe($.cloudfront(cloudfrontConfig))
// .pipe(s3Index(cloudfrontConfig));
});

gulp.task('sftp_staging', function () {
return gulp.src('dist/**/*.*')
.pipe($.sftp(deployConfig.staging));
Expand Down Expand Up @@ -255,7 +216,7 @@ gulp.task('wiredep', () => {
.pipe(gulp.dest('app'));
});

gulp.task('build', ['lint', 'html', 'images', 'fonts', 'videos', 'extras'], () => {
gulp.task('build', ['lint', 'html', 'images', 'videos', 'extras'], () => {
return gulp.src('dist/**/*').pipe($.size({
title: 'build',
gzip: true
Expand Down

0 comments on commit 6b69dc6

Please sign in to comment.