vac.dev/gulpfile.babel.js

100 lines
2.6 KiB
JavaScript
Raw Normal View History

import { dest, series, parallel, src, watch as gwatch } from 'gulp'
import autoprefixer from 'autoprefixer'
import browserSync from 'browser-sync'
import spawn from 'cross-spawn'
import cssnano from 'cssnano'
import postcss from 'gulp-postcss'
import atimport from 'postcss-import'
import imagemin from 'gulp-imagemin'
import minify from 'gulp-minify'
import tailwindcss from 'tailwindcss'
const SITE_ROOT = './_site'
const POST_BUILD_STYLESHEET = `${SITE_ROOT}/assets/css/`
const PRE_BUILD_STYLESHEET = './assets/css/style.css'
const IMAGES = './assets/img/**/*'
const IMAGES_MINIMIZED = `${SITE_ROOT}/assets/img/`
const TAILWIND_CONFIG = './tailwind.config.js'
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
// Fix for Windows compatibility
const jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll'
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
const isDevelopmentBuild = process.env.NODE_ENV === 'development'
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
const content = () => {
browserSync.notify('Building Jekyll site...')
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
const args = ['exec', jekyll, 'build']
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
if (isDevelopmentBuild) {
args.push('--incremental')
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
}
return spawn('bundle', args, { stdio: 'inherit' })
}
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
const scripts = () =>
src('./assets/js/*')
.pipe(minify({ext:{min:'.min.js' }, mangle: true}))
.pipe(dest(`${SITE_ROOT}/assets/js/`))
.pipe(browserSync.stream())
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
const styles = () =>
src(PRE_BUILD_STYLESHEET)
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
.pipe(
postcss([
atimport(),
tailwindcss(TAILWIND_CONFIG),
...(isDevelopmentBuild ? [] : [autoprefixer(), cssnano()]),
])
)
.pipe(dest(POST_BUILD_STYLESHEET))
.pipe(browserSync.stream())
const cname = () =>
src('assets/CNAME').pipe(dest(SITE_ROOT))
const images = () =>
src(IMAGES)
.pipe(imagemin([
imagemin.gifsicle({ interlaced: true }),
imagemin.optipng({ optimizationLevel: 3 }),
imagemin.svgo(),
]))
.pipe(dest(IMAGES_MINIMIZED))
.pipe(browserSync.stream())
const server = () =>
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
browserSync.init({
files: [SITE_ROOT + '/**'],
open: 'local',
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
port: 4000,
server: {
baseDir: SITE_ROOT,
serveStaticOptions: {
extensions: ['html'],
New design (#42) (#45) * Add new design * Use yarn instead of npm * Add 404 page style * Update "See VAC Openings" CTA * Change VAC to Vac * Change specs link * Keep post categories * Change code formatting * Update images * Update media links * Add media image default * Update package.json * Add twitter cards meta data * Add media section back * Remove images * Comment script for form * Change media urls to https * Import font locally * Add Anonymous font * Change inner page layout * Change pre code style * Add font preloading * Change post content styles * Add alt attribute * Change footer research links * Update gitignore * Add Fathom analytics * Update links * Change gif to video * Add work cards links back * Change footer spacing * Change logo size * Fix header * Centered section join * Make cards clickable * Align left section join * Remove graphic & video section about * Return logo size * Add post for Waku v1 vs Waku v2 bandwidth comparison (#43) * Add post for Waku v1 vs Waku v2 bandwidth comparison * Addressing PR comments * Added future work. Minor changes to intro. (cherry picked from commit 007696cfc9898178a03a34123c59176913de3463) * Add <code> styles * Add Hanno page * Add opinion piece on ethics in surveillance tech (#44) * Add opinion piece on ethics in surveillance tech * Change published date. Added preface. * wrong date - today is 3rd (cherry picked from commit c64f5a889e48525a24313b17be808411620d1622) * Add circe page Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com> Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: thecirce <95408261+thecirce@users.noreply.github.com>
2021-12-14 04:03:25 +00:00
},
},
})
const watch = () => {
gwatch(['_authors/*', '_data/*', '_posts/*', '_layouts/*', '_includes/*'], content)
gwatch('**/*.js', scripts)
gwatch(PRE_BUILD_STYLESHEET, styles)
gwatch(IMAGES, images)
//'!_site/**/*',
//'!node_modules/**/*',
}
const build = series(content, scripts, styles, images, cname)
exports.content = content
exports.scripts = scripts
exports.styles = styles
exports.images = images
exports.cname = cname
exports.watch = watch
exports.server = server
exports.build = build
exports.devel = series(build, parallel(server, watch))
exports.default = exports.build