mirror of
https://github.com/Xevion/old.xevion.github.io.git
synced 2025-12-06 15:15:39 -06:00
gulp prod
This commit is contained in:
@@ -11,8 +11,8 @@ keep_files:
|
|||||||
|
|
||||||
# Site settings
|
# Site settings
|
||||||
baseurl: ""
|
baseurl: ""
|
||||||
title: Brittany Chiang | Front End Software Engineer
|
|
||||||
name: Brittany Chiang
|
name: Brittany Chiang
|
||||||
|
title: Brittany Chiang | Front End Software Engineer
|
||||||
description: Design-minded, detail oriented software engineer passionate about combining beautiful code with beautiful design.
|
description: Design-minded, detail oriented software engineer passionate about combining beautiful code with beautiful design.
|
||||||
url: http://brittanychiang.com # the base hostname & protocol for your site
|
url: http://brittanychiang.com # the base hostname & protocol for your site
|
||||||
email: brittany.chiang@gmail.com
|
email: brittany.chiang@gmail.com
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<h1 class="heading" data-content="Brittany Chiang"><span class="name">Brittany Chiang</span></h1>
|
<h1 class="heading" data-content="Brittany Chiang"><span class="name">Brittany Chiang</span></h1>
|
||||||
<div class="action-wrapper">
|
<div class="action-wrapper">
|
||||||
<p class="subtext">
|
<p class="subtext">
|
||||||
<a class="btn main-action">Front-End Software Engineer</a>
|
<a class="btn main-action">Front End Software Engineer</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
1948
css/main.css
1948
css/main.css
File diff suppressed because one or more lines are too long
81
gulpfile.js
81
gulpfile.js
@@ -4,8 +4,7 @@ var cp = require('child_process');
|
|||||||
var htmlmin = require('gulp-htmlmin');
|
var htmlmin = require('gulp-htmlmin');
|
||||||
var sass = require('gulp-sass');
|
var sass = require('gulp-sass');
|
||||||
var cleanCSS = require('gulp-clean-css');
|
var cleanCSS = require('gulp-clean-css');
|
||||||
var autoprefix = require('gulp-autoprefixer');
|
var prefix = require('gulp-autoprefixer');
|
||||||
var concat = require('gulp-concat');
|
|
||||||
var jshint = require('gulp-jshint');
|
var jshint = require('gulp-jshint');
|
||||||
var babel = require('gulp-babel');
|
var babel = require('gulp-babel');
|
||||||
var uglify = require('gulp-uglify');
|
var uglify = require('gulp-uglify');
|
||||||
@@ -14,23 +13,24 @@ var deploy = require('gulp-gh-pages');
|
|||||||
|
|
||||||
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
|
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
|
||||||
var messages = {
|
var messages = {
|
||||||
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
|
jekyllDev: 'Running: $ jekyll build for dev',
|
||||||
|
jekyllProd: 'Running: $ jekyll build for prod'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build the Jekyll Site
|
// Build the Jekyll Site
|
||||||
gulp.task('jekyll-build', function(done) {
|
gulp.task('jekyll-dev', function(done) {
|
||||||
browserSync.notify(messages.jekyllBuild);
|
browserSync.notify(messages.jekyllDev);
|
||||||
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
|
return cp.spawn( jekyll , ['build', '--drafts', '--config', '_config.yml'], {stdio: 'inherit'})
|
||||||
.on('close', done);
|
.on('close', done);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Rebuild Jekyll & do page reload
|
// Rebuild Jekyll & reload the page
|
||||||
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
|
gulp.task('jekyll-rebuild', ['jekyll-dev'], function () {
|
||||||
browserSync.reload();
|
browserSync.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for jekyll-build, then launch the Server
|
// Wait for jekyll-dev task to complete, then launch the Server
|
||||||
gulp.task('browser-sync', ['styles', 'jekyll-build'], function() {
|
gulp.task('browser-sync', ['styles', 'scripts', 'jekyll-dev'], function() {
|
||||||
browserSync({
|
browserSync({
|
||||||
server: {
|
server: {
|
||||||
baseDir: '_site'
|
baseDir: '_site'
|
||||||
@@ -38,7 +38,6 @@ gulp.task('browser-sync', ['styles', 'jekyll-build'], function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
gulp.task('htmlmin', function() {
|
gulp.task('htmlmin', function() {
|
||||||
return gulp.src('*.html')
|
return gulp.src('*.html')
|
||||||
.pipe(htmlmin({collapseWhitespace: true, removeComments: true}))
|
.pipe(htmlmin({collapseWhitespace: true, removeComments: true}))
|
||||||
@@ -53,8 +52,7 @@ gulp.task('styles', function() {
|
|||||||
onError: browserSync.notify
|
onError: browserSync.notify
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.pipe(cleanCSS({compatibility: 'ie8'}))
|
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {cascade: true}))
|
||||||
.pipe(autoprefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
|
|
||||||
.pipe(gulp.dest('_site/css'))
|
.pipe(gulp.dest('_site/css'))
|
||||||
.pipe(browserSync.reload({stream:true}))
|
.pipe(browserSync.reload({stream:true}))
|
||||||
.pipe(gulp.dest('css'));
|
.pipe(gulp.dest('css'));
|
||||||
@@ -67,8 +65,42 @@ gulp.task('scripts', function() {
|
|||||||
.pipe(babel({
|
.pipe(babel({
|
||||||
presets: ['es2015']
|
presets: ['es2015']
|
||||||
}))
|
}))
|
||||||
//.pipe(concat('scripts.js'))
|
.pipe(gulp.dest('_site/js'))
|
||||||
//.pipe(uglify())
|
.pipe(browserSync.reload({stream:true}));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Watch scss files for changes & recompile
|
||||||
|
// Watch html/md files, run jekyll & reload BrowserSync
|
||||||
|
gulp.task('watch', function () {
|
||||||
|
gulp.watch(['_scss/**/*.scss','_scss/*.scss'], ['styles']);
|
||||||
|
gulp.watch(['js/*.js'], ['scripts']);
|
||||||
|
gulp.watch(['index.html', '404.html', '_layouts/*.html', '_posts/*', '_includes/*.html', '_drafts/*', '**/*.html'], ['htmlmin', 'jekyll-rebuild']);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Build the Jekyll Site in production mode
|
||||||
|
gulp.task('jekyll-prod', function (done) {
|
||||||
|
browserSync.notify(messages.jekyllProd);
|
||||||
|
return cp.spawn('jekyll', ['build'], {stdio: 'inherit'})
|
||||||
|
.on('close', done);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Identical Sass compilation task to development mode, with an additional minification step thrown in using clean-css
|
||||||
|
gulp.task('styles-prod', function () {
|
||||||
|
return gulp.src('_sass/styles.scss')
|
||||||
|
.pipe(sass({
|
||||||
|
includePaths: ['scss'],
|
||||||
|
onError: browserSync.notify
|
||||||
|
}))
|
||||||
|
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
|
||||||
|
.pipe(cleanCSS({compatibility: 'ie8'}))
|
||||||
|
.pipe(gulp.dest('_site/css'))
|
||||||
|
.pipe(gulp.dest('css'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Identical Javascript compilation task to development mode, with an additional minification step thrown in using uglify
|
||||||
|
gulp.task('scripts-prod', function() {
|
||||||
|
return gulp.src(['js/*.js'])
|
||||||
|
.pipe(uglify())
|
||||||
.pipe(gulp.dest('_site/js'));
|
.pipe(gulp.dest('_site/js'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,22 +112,17 @@ gulp.task('images', function() {
|
|||||||
|
|
||||||
gulp.task('fonts', function() {
|
gulp.task('fonts', function() {
|
||||||
return gulp.src('fonts/**/*')
|
return gulp.src('fonts/**/*')
|
||||||
.pipe(gulp.dest('_site/fonts'))
|
.pipe(gulp.dest('_site/fonts'));
|
||||||
})
|
|
||||||
|
|
||||||
// Watch scss files for changes & recompile
|
|
||||||
// Watch html/md files, run jekyll & reload BrowserSync
|
|
||||||
gulp.task('watch', function() {
|
|
||||||
gulp.watch(['*.html', '_layouts/*.html', '_includes/*.html', '_data/*.yml'], ['jekyll-rebuild']);
|
|
||||||
gulp.watch('_scss/**/*.scss', ['styles']);
|
|
||||||
gulp.watch('js/*.js', ['scripts']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Default task, running just gulp will compile the sass, compile the Jekyll site, launch BrowserSync & watch files.
|
||||||
|
gulp.task('default', ['browser-sync', 'watch']);
|
||||||
|
|
||||||
|
// Build task, run using gulp build to compile Sass and Javascript ready for deployment.
|
||||||
|
gulp.task('build', ['fonts', 'images', 'styles-prod', 'scripts-prod', 'jekyll-prod']);
|
||||||
|
|
||||||
// deploy to github pages
|
// deploy to github pages
|
||||||
gulp.task('deploy', ["jekyll-build"], function () {
|
gulp.task('deploy', ["jekyll-build"], function () {
|
||||||
return gulp.src("./_site/**/*")
|
return gulp.src("./_site/**/*")
|
||||||
.pipe(deploy());
|
.pipe(deploy());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default task, running just `gulp` will compile the sass, compile the jekyll site, launch BrowserSync & watch files.
|
|
||||||
gulp.task('default', ['browser-sync', 'watch']);
|
|
||||||
|
|||||||
68
js/main.js
68
js/main.js
@@ -1,34 +1,37 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
const contentSections = $('.section');
|
// ==================== VERTICAL NAV ==================== //
|
||||||
const navigationItems = $('#dot-nav a');
|
var contentSections = $('.section'),
|
||||||
const overlayItems = $('#overlay a');
|
navigationItems = $('#dot-nav a'),
|
||||||
|
overlayItems = $('#overlay a');
|
||||||
$(window).on('scroll', () => { updateNavigation(); });
|
updateNavigation();
|
||||||
|
$(window).on('scroll', function() {
|
||||||
|
updateNavigation();
|
||||||
|
});
|
||||||
//smooth scroll to the section
|
//smooth scroll to the section
|
||||||
navigationItems.on('click', event => {
|
navigationItems.on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
smoothScroll($(this.hash));
|
smoothScroll($(this.hash));
|
||||||
});
|
});
|
||||||
overlayItems.on('click', event => {
|
overlayItems.on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
smoothScroll($(this.hash));
|
smoothScroll($(this.hash));
|
||||||
$('#toggle').click();
|
$('#toggle').click();
|
||||||
});
|
});
|
||||||
// smooth scroll to second section
|
// smooth scroll to second section
|
||||||
$('.scroll-down').on('click', event => {
|
$('.scroll-down').on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
smoothScroll($(this.hash));
|
smoothScroll($(this.hash));
|
||||||
});
|
});
|
||||||
// close navigation on touch devices when selectinG an elemnt from the list
|
// close navigation on touch devices when selectinG an elemnt from the list
|
||||||
$('.touch #dot-nav a').on('click', () => {
|
$('.touch #dot-nav a').on('click', function() {
|
||||||
$('.touch #dot-nav').removeClass('open');
|
$('.touch #dot-nav').removeClass('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ==================== VERTICAL NAV ON SCROLL ==================== //
|
// ==================== VERTICAL NAV ON SCROLL ==================== //
|
||||||
$(document).scroll( () => {
|
$(document).scroll(function() {
|
||||||
const x = $(window).width();
|
var x = $(window).width();
|
||||||
const y = $(this).scrollTop();
|
var y = $(this).scrollTop();
|
||||||
const $nav = $('#dot-nav');
|
var $nav = $('#dot-nav');
|
||||||
if (x > 768 && y > 500) {
|
if (x > 768 && y > 500) {
|
||||||
$nav.fadeIn();
|
$nav.fadeIn();
|
||||||
} else {
|
} else {
|
||||||
@@ -37,9 +40,9 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateNavigation() {
|
function updateNavigation() {
|
||||||
contentSections.each( () => {
|
contentSections.each(function() {
|
||||||
const $this = $(this);
|
var $this = $(this);
|
||||||
const activeSection = $('#dot-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
|
var activeSection = $('#dot-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
|
||||||
if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
|
if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
|
||||||
navigationItems.eq(activeSection).addClass('is-selected');
|
navigationItems.eq(activeSection).addClass('is-selected');
|
||||||
} else {
|
} else {
|
||||||
@@ -58,7 +61,7 @@ $(function() {
|
|||||||
$('#overlay').toggleClass('open');
|
$('#overlay').toggleClass('open');
|
||||||
$('body').toggleClass('noScroll');
|
$('body').toggleClass('noScroll');
|
||||||
});
|
});
|
||||||
$(window).on('resize', event => {
|
$(window).on('resize', function(event) {
|
||||||
var windowWidth = $(window).width();
|
var windowWidth = $(window).width();
|
||||||
var isOpen = $('#overlay').hasClass('open');
|
var isOpen = $('#overlay').hasClass('open');
|
||||||
|
|
||||||
@@ -74,7 +77,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ==================== CONTACT FORM ==================== //
|
// ==================== CONTACT FORM ==================== //
|
||||||
const $contactInput = $('.contact-input');
|
var $contactInput = $('.contact-input');
|
||||||
$contactInput.focus(function() {
|
$contactInput.focus(function() {
|
||||||
$(this).parent().addClass('is-active is-completed');
|
$(this).parent().addClass('is-active is-completed');
|
||||||
});
|
});
|
||||||
@@ -85,12 +88,13 @@ $(function() {
|
|||||||
$(this).parent().removeClass('is-active');
|
$(this).parent().removeClass('is-active');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).one('focus.textarea', '.autoExpand', () => {
|
$(document).one('focus.textarea', '.autoExpand', function() {
|
||||||
const savedValue = this.value;
|
var savedValue = this.value;
|
||||||
this.value = '';
|
this.value = '';
|
||||||
this.baseScrollHeight = this.scrollHeight;
|
this.baseScrollHeight = this.scrollHeight;
|
||||||
this.value = savedValue;
|
this.value = savedValue;
|
||||||
}).on('input.textarea', '.autoExpand', () => {
|
})
|
||||||
|
.on('input.textarea', '.autoExpand', function() {
|
||||||
var minRows = this.getAttribute('data-min-rows') | 0,
|
var minRows = this.getAttribute('data-min-rows') | 0,
|
||||||
rows;
|
rows;
|
||||||
this.rows = minRows;
|
this.rows = minRows;
|
||||||
@@ -98,23 +102,23 @@ $(function() {
|
|||||||
this.rows = minRows + rows;
|
this.rows = minRows + rows;
|
||||||
});
|
});
|
||||||
|
|
||||||
const isMobile = {
|
var isMobile = {
|
||||||
Android() {
|
Android: function() {
|
||||||
return navigator.userAgent.match(/Android/i);
|
return navigator.userAgent.match(/Android/i);
|
||||||
},
|
},
|
||||||
BlackBerry() {
|
BlackBerry: function() {
|
||||||
return navigator.userAgent.match(/BlackBerry/i);
|
return navigator.userAgent.match(/BlackBerry/i);
|
||||||
},
|
},
|
||||||
iOS() {
|
iOS: function() {
|
||||||
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
||||||
},
|
},
|
||||||
Opera() {
|
Opera: function() {
|
||||||
return navigator.userAgent.match(/Opera Mini/i);
|
return navigator.userAgent.match(/Opera Mini/i);
|
||||||
},
|
},
|
||||||
Windows() {
|
Windows: function() {
|
||||||
return navigator.userAgent.match(/IEMobile/i);
|
return navigator.userAgent.match(/IEMobile/i);
|
||||||
},
|
},
|
||||||
any() {
|
any: function() {
|
||||||
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
|
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -129,11 +133,5 @@ $(function() {
|
|||||||
forceHeight: false
|
forceHeight: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
});
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
|
||||||
ga('create', 'UA-84377262-1', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Brittany Chiang",
|
"name": "Brittany Chiang",
|
||||||
|
"author": "Brittany Chiang",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Personal website of Brittany Chiang",
|
"description": "Personal website of Brittany Chiang",
|
||||||
"main": "gulpfile.js",
|
"main": "gulpfile.js",
|
||||||
"author": "Brittany Chiang",
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-preset-es2015": "^6.18.0",
|
"babel-preset-es2015": "^6.18.0",
|
||||||
"browser-sync": "^2.18.2",
|
"browser-sync": "^2.18.2",
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/bchiang7/bchiang7.github.io"
|
"url": "https://github.com/bchiang7/bchiang7.github.io"
|
||||||
},
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"jekyll",
|
"jekyll",
|
||||||
"gulp",
|
"gulp",
|
||||||
|
|||||||
Reference in New Issue
Block a user