-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…esolves #10
- Loading branch information
Showing
16 changed files
with
283 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
clean: | ||
# These folders will be deleted | ||
- "_site" | ||
|
||
browsersync: | ||
notify: true | ||
open: false | ||
port: 3000 | ||
server: | ||
basedir: "_site/" | ||
xip: true | ||
|
||
javascript: | ||
dest: "assets/js/" | ||
dev: | ||
dest: "_site/assets/js/" | ||
# filename to output | ||
filename: "all.js" | ||
notification: "Running JavaScript" | ||
# Paths to JavaScript libraries, which are compined into one file | ||
src: | ||
# Libraries requried by Foundation | ||
- "assets/vendor/jquery/dist/jquery.js" | ||
|
||
# Core Foundation files, all F6 components need this! | ||
- "assets/vendor/foundation-sites/js/foundation.core.js" | ||
|
||
# Individual Foundation components | ||
# If you aren't using a component, just remove it from the list | ||
# "assets/vendor/foundation-sites/js/foundation.abide.js", | ||
# "assets/vendor/foundation-sites/js/foundation.accordion.js", | ||
# "assets/vendor/foundation-sites/js/foundation.accordionMenu.js", | ||
# "assets/vendor/foundation-sites/js/foundation.drilldown.js", | ||
# "assets/vendor/foundation-sites/js/foundation.dropdown.js", | ||
# "assets/vendor/foundation-sites/js/foundation.dropdownMenu.js", | ||
# "assets/vendor/foundation-sites/js/foundation.equalizer.js", | ||
# "assets/vendor/foundation-sites/js/foundation.interchange.js", | ||
# "assets/vendor/foundation-sites/js/foundation.magellan.js", | ||
# "assets/vendor/foundation-sites/js/foundation.offcanvas.js", | ||
# "assets/vendor/foundation-sites/js/foundation.orbit.js", | ||
# "assets/vendor/foundation-sites/js/foundation.responsiveMenu.js", | ||
# "assets/vendor/foundation-sites/js/foundation.responsiveToggle.js", | ||
# "assets/vendor/foundation-sites/js/foundation.reveal.js", | ||
# "assets/vendor/foundation-sites/js/foundation.slider.js", | ||
# "assets/vendor/foundation-sites/js/foundation.sticky.js", | ||
# "assets/vendor/foundation-sites/js/foundation.tabs.js", | ||
# "assets/vendor/foundation-sites/js/foundation.toggler.js", | ||
# "assets/vendor/foundation-sites/js/foundation.tooltip.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.box.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.keyboard.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.mediaQuery.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.motion.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.nest.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.timerAndImageLoader.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.touch.js", | ||
# "assets/vendor/foundation-sites/js/foundation.util.triggers.js", | ||
|
||
# Paths to your own project code are here | ||
- "assets/js/!(app).js" | ||
- "assets/js/app.js" | ||
|
||
jekyll: | ||
notification: "Running jekyll" | ||
notificationIncremental: "Running jekyll incremental" | ||
|
||
revision: | ||
revision: | ||
dest: "_site/assets" | ||
manifest: | ||
dest: "./" | ||
src: | ||
[ | ||
'assets/css/app.css', | ||
'assets/js/all.js', | ||
'assets/img/**' | ||
] | ||
collect: | ||
dest: "_site" | ||
src: | ||
[ | ||
'./rev-manifest.json', | ||
'_site/*.{html,xml,txt,json,css,js}', | ||
'_site/**/*.{html,xml,txt,json,css,js}', | ||
'!_site/assets/vendor' | ||
] | ||
|
||
sass: | ||
# Autoprefixer will make sure your CSS works with these browsers | ||
compatibility: | ||
- "last 2 versions" | ||
- "ie >= 9" | ||
dest: "assets/css/" | ||
dev: | ||
dest: "_site/assets/css/" | ||
notification: "Running Sass" | ||
src: "assets/scss/*.scss" | ||
|
||
watch: | ||
images: "assets/img/**/*" | ||
javascript: "assets/js/app.js" | ||
sass: "assets/scss/**/*.scss" | ||
pages: | ||
[ | ||
'*.{md,html,yml,xml}', | ||
'{_data,_includes,_layouts,_pages,_posts}/**/*.{md,html,yml,xml}', | ||
'!_site/**/*.*', | ||
'!assets/**/*.*' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var browserSync = require('browser-sync'); | ||
var config = require('../util/loadConfig').browsersync; | ||
var gulp = require('gulp'); | ||
|
||
gulp.task('browser-sync', function() { | ||
browserSync.init({ | ||
notify: config.notify, | ||
open: config.open, | ||
port: config.port, | ||
server: { | ||
baseDir: config.server.basedir | ||
}, | ||
xip: config.xip | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var gulp = require('gulp'); | ||
var isProduction = require('../util/isProduction'); | ||
var sequence = require('run-sequence'); | ||
|
||
gulp.task('build', function(done) { | ||
if(isProduction) { | ||
sequence('clean', ['sass', 'javascript'], 'jekyll-build', 'rev:collect', done); | ||
} else { | ||
sequence('clean', ['sass', 'javascript'], 'jekyll-build', done); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var config = require('../util/loadConfig').clean; | ||
var del = require('del'); | ||
var gulp = require('gulp'); | ||
|
||
gulp.task('clean', function(done) { | ||
del(config); | ||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var gulp = require('gulp'); | ||
var sequence = require('run-sequence'); | ||
|
||
gulp.task('default', function(done) { | ||
sequence('build', 'browser-sync', 'watch', done); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var $ = require('gulp-load-plugins')(); | ||
var browserSync = require('browser-sync'); | ||
var config = require('../util/loadConfig').javascript; | ||
var gulp = require('gulp'); | ||
var isProduction = require('../util/isProduction'); | ||
|
||
gulp.task('javascript', function() { | ||
browserSync.notify(config.notification); | ||
var uglify = $.if(isProduction, $.uglify() | ||
.on('error', function (e) { | ||
console.log(e); | ||
})); | ||
|
||
return gulp.src(config.src) | ||
.pipe($.sourcemaps.init()) | ||
.pipe($.concat(config.filename)) | ||
.pipe($.if(isProduction, $.uglify({ mangle: false }))) | ||
.pipe($.if(!isProduction, $.sourcemaps.write())) | ||
// for live injecting (for production builds we write the revised version) | ||
.pipe($.if(!isProduction, gulp.dest(config.dev.dest))) | ||
// for future jekyll builds | ||
.pipe(gulp.dest(config.dest)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var browserSync = require('browser-sync'); | ||
var config = require('../util/loadConfig').jekyll; | ||
var gulp = require('gulp'); | ||
var isProduction = require('../util/isProduction'); | ||
var spawn = require('cross-spawn'); | ||
|
||
gulp.task('jekyll-build', function(done) { | ||
browserSync.notify(config.notification); | ||
// Spawn jekyll commands | ||
if (isProduction) { | ||
return spawn('bundle', ['exec', 'jekyll', 'build', | ||
'--config', '_config.yml,_config-production.yml'], {stdio: 'inherit'}) | ||
.on('close', done); | ||
} else { | ||
return spawn('bundle', ['exec', 'jekyll', 'build'], {stdio: 'inherit'}) | ||
.on('close', done); | ||
} | ||
}); | ||
|
||
gulp.task('jekyll-incremental', function(done) { | ||
browserSync.notify(config.notificationIncremental); | ||
// Spawn jekyll commands | ||
return spawn('bundle', ['exec', 'jekyll', 'build', '--incremental'], {stdio: 'inherit'}) | ||
.on('close', done); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var collect = require('gulp-rev-collector'); | ||
var config = require('../util/loadConfig').revision; | ||
var gulp = require('gulp'); | ||
var rev = require('gulp-rev'); | ||
|
||
// Revision asset files in the source dir and write a manifest file | ||
gulp.task('revision', function() { | ||
return gulp.src(config.revision.src, {base: 'assets'}) | ||
.pipe(rev()) | ||
// write revised assets to _site dir | ||
.pipe(gulp.dest(config.revision.dest)) | ||
.pipe(rev.manifest()) | ||
// write manifest to jekyll root | ||
.pipe(gulp.dest(config.revision.manifest.dest)); | ||
}); | ||
|
||
// Replace links to assets in files (_site dir) from a manifest file | ||
gulp.task('rev:collect', ['revision'], function() { | ||
return gulp.src(config.collect.src) | ||
.pipe(collect()) | ||
.pipe(gulp.dest(config.collect.dest)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var $ = require('gulp-load-plugins')(); | ||
var autoprefixer = require('gulp-autoprefixer'); | ||
var browserSync = require('browser-sync'); | ||
var config = require('../util/loadConfig').sass; | ||
var gulp = require('gulp'); | ||
var isProduction = require('../util/isProduction'); | ||
var sass = require('gulp-sass'); | ||
|
||
gulp.task('sass', function() { | ||
browserSync.notify(config.notification); | ||
var minifycss = $.if(isProduction, $.cssnano()); | ||
|
||
return gulp.src(config.src) | ||
.pipe($.sourcemaps.init()) | ||
.pipe($.sass() | ||
.on('error', $.sass.logError)) | ||
.pipe(autoprefixer(config.compatibility)) | ||
.pipe(minifycss) | ||
.pipe($.if(!isProduction, $.sourcemaps.write())) | ||
// for live injecting (for production builds we write the revised version) | ||
.pipe($.if(!isProduction, gulp.dest(config.dev.dest))) | ||
// for future jekyll builds | ||
.pipe(gulp.dest(config.dest)) | ||
//auto-inject styles into browsers | ||
.pipe(browserSync.stream()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var browserSync = require('browser-sync'); | ||
var config = require('../util/loadConfig').watch; | ||
var gulp = require('gulp'); | ||
|
||
// Watch files for changes, recompile/rebuild and reload the browser | ||
gulp.task('watch', function() { | ||
gulp.watch(config.pages, ['jekyll-incremental', browserSync.reload]); | ||
gulp.watch(config.images, ['jekyll-incremental', browserSync.reload]); | ||
gulp.watch(config.javascript, ['javascript', browserSync.reload]); | ||
//no browser reload needed here, browserSync injects the stylesheet into browsers | ||
gulp.watch(config.sass, ['sass']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var argv = require('yargs').argv; | ||
|
||
// Check for --production flag | ||
var isProduction = !!(argv.production); | ||
|
||
module.exports = isProduction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var fs = require('fs'); | ||
var yaml = require('js-yaml'); | ||
|
||
function loadConfig() { | ||
var ymlFile = fs.readFileSync('gulp/config.yml', 'utf8'); | ||
return yaml.load(ymlFile); | ||
} | ||
|
||
var config = loadConfig(); | ||
|
||
module.exports = config; |
Oops, something went wrong.