Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jekyll): Speed up local builds #1489

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,41 @@ function js() {
return gulp.src(sources.js)
.pipe($.plumber())
.pipe($.if(dev, $.sourcemaps.init()))
.pipe($.minify({
noSource: true,
ext: {
min: '.js'
}
}))
.pipe($.concat('app.js'))
.pipe($.if(dev, $.sourcemaps.write()))
.pipe(gulp.dest('dist/assets'))
.pipe($.size())
.pipe(browserSync.stream())
}

function js_min() {
return gulp.src(sources.js)
.pipe($.plumber())
.pipe($.if(dev, $.sourcemaps.init()))
.pipe($.minify({
noSource: true,
ext: {
min: '.js'
}
}))
.pipe($.concat('app.js'))
.pipe($.if(dev, $.sourcemaps.write()))
.pipe(gulp.dest('dist/assets'))
.pipe($.size())
.pipe(browserSync.stream())
}

function images() {
return gulp.src(sources.images)
.pipe($.plumber())
.pipe($.imagemin())
.pipe(gulp.dest(paths.dist + 'assets/images'))
.pipe($.size())
}

function images_min() {
return gulp.src(sources.images)
.pipe($.plumber())
.pipe($.imagemin())
.pipe(gulp.dest(paths.dist + 'assets/images'))
.pipe($.size())
}

function fonts() {
Expand All @@ -119,7 +135,17 @@ function fonts() {
}

function jekyll(cb) {
var command = 'bundle exec jekyll build --config jekyll.yml --destination ' + paths.dist
var command = 'bundle exec jekyll build --config jekyll.yml --profile --destination ' + paths.dist

childProcess.exec(command, function (err, stdout, stderr) {
log(stdout)
log(stderr)
cb(err)
})
}

function jekyll_dev(cb) {
var command = 'bundle exec jekyll build --config jekyll-dev.yml --profile --destination ' + paths.dist

childProcess.exec(command, function (err, stdout, stderr) {
log(stdout)
Expand All @@ -131,8 +157,6 @@ function jekyll(cb) {
function html() {
return gulp.src(paths.dist + '/**/*.html')
.pipe($.plumber())
// Prefetch static assets
// .pipe($.resourceHints())
.pipe(gulp.dest(paths.dist))
.pipe($.size())
}
Expand Down Expand Up @@ -385,7 +409,7 @@ function clean() {
}

function watch_files() {
gulp.watch(sources.content, gulp.series(jekyll, html, reload))
gulp.watch(sources.content, gulp.series(jekyll_dev, html, reload))
gulp.watch(sources.styles, styles)
gulp.watch(sources.images, gulp.series(images, reload))
gulp.watch(sources.js, gulp.series(js, reload))
Expand All @@ -401,11 +425,14 @@ function set_dev(cb) {

// Basic Tasks
gulp.task("js", js)
gulp.task("js_min", js_min)
gulp.task("css", css)
gulp.task("styles", styles)
gulp.task("images", images)
gulp.task("images_min", images_min)
gulp.task("fonts", fonts)
gulp.task("jekyll", jekyll)
gulp.task("jekyll_dev", jekyll_dev)
gulp.task("html", html)

// Lua Tasks
Expand All @@ -429,6 +456,6 @@ gulp.task("watch", gulp.series(browser_sync, watch_files))

gulp.task("dev", gulp.series(set_dev, clean, gulp.parallel(js, images, fonts, css), jekyll, html, styles, browser_sync, watch_files))

gulp.task('default', gulp.series(clean, gulp.parallel(js, images, fonts, css), jekyll, html, styles, browser_sync, watch_files))
gulp.task('default', gulp.series(clean, gulp.parallel(js, images, fonts, css), jekyll_dev, html, styles, browser_sync, watch_files))

gulp.task("deploy", gulp.series(gulp.parallel(js, images, fonts, css), jekyll, html, styles, gh_pages))
gulp.task("deploy", gulp.series(gulp.parallel(js_min, images_min, fonts, css), jekyll, html, styles, gh_pages))
110 changes: 110 additions & 0 deletions jekyll-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Build settings
source: app
destination: dist
permalink: pretty
timezone: America/San_Francisco
markdown: kramdown
incremental: true

kramdown:
syntax_highlighter_opts:
disable : true

keep_files:
- assets

# Site settings
name: Kong
title: Open-Source API Management and Microservice Management
description: "Secure, Manage & Extend your APIs or Microservices with plugins for authentication, logging, rate-limiting, transformations and more."
links:
web: https://docs.konghq.com
share: https://docs.konghq.com # legacy link, must maintain for social sharing counters
download: https://bintray.com/kong
instaclustr: "https://www.instaclustr.com/products/kong/?utm_source=partnership&utm_medium=link&utm_campaign=mashape"
repos:
kong: https://github.com/Kong/kong
docs: https://github.com/Kong/docs.konghq.com
vagrant: https://github.com/Kong/kong-vagrant
homebrew: https://github.com/Kong/homebrew-kong
cloudformation: https://github.com/Kong/kong-dist-cloudformation
oauth2_hello_world: https://github.com/Kong/kong-oauth2-hello-world

collections:
hub:
output: true
layout: extension

# for Kong platform extensions (not Jekyll)
extensions:
categories:
- name: Authentication
slug: authentication
desc: Protect your services with an authentication layer
- name: Security
slug: security
desc: Protect your services with additional security layer
- name: Traffic Control
slug: traffic-control
desc: Manage, throttle and restrict inbound and outbound API traffic
- name: Serverless
slug: serverless
desc: Invoke serverless functions in combination with other plugins
- name: Analytics & Monitoring
slug: analytics-monitoring
desc: Visualize, inspect and monitor APIs and microservices traffic
- name: Transformations
slug: transformations
desc: Transform request and responses on the fly on Kong
- name: Logging
slug: logging
desc: Log request and response data using the best transport for your infrastructure
- name: Deployment
slug: deployment
desc: Deploy and configure Kong in many environments
types:
- name: plugin
slug: plugin
- name: integration
slug: integration
# - name: dev portal extension
# slug: dev-mod

exclude:
- node_modules
- jekyll-cache

# location vars
icons_dir: assets/images/icons

plugins:
- jekyll-redirect-from

defaults:
- scope:
path: ''
values:
layout: 'docs'

- scope:
path: 'install'
values:
layout: 'install'

- scope:
path: 'docs/ee'
values:
layout: 'docs'

- scope:
path: 'about'
values:
layout: 'about'
header_html: '<a class="github-button" href="https://github.com/Kong/kong" data-style="mega" data-count-href="/Kong/kong/stargazers" data-count-api="/repos/Kong/kong#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star Kong/kong on GitHub">Star</a>&nbsp;<a class="github-button" href="https://github.com/Kong/kong/fork" data-icon="octicon-repo-forked" data-style="mega" data-count-href="/Kong/kong/network" data-count-api="/repos/Kong/kong#forks_count" data-count-aria-label="# forks on GitHub" aria-label="Fork Kong/kong on GitHub">Fork</a>'
breadcrumbs: null

- scope:
type: hub
values:
layout: extension
permalink: /:collection/:path