A Minimal Gulp Pipeline
The Goal of This Demo
Section titled “The Goal of This Demo”This is not about mastery.
This is about seeing the model once.
You are not learning Gulp as a tool you’ll reuse.
You are learning what pipeline-based automation looked like.
That’s it.
What We’re Building
Section titled “What We’re Building”A tiny “chapter” that:
- uses shared WebDevTnT CSS/JS during development
- includes chapter-local CSS/JS and a hero image
- runs a build step that produces a fully portable
dist/ - supports hot reload via a local dev server
Key output goal: dist/ is deploy-ready (no references to files outside dist/).
Folder Architecture
Section titled “Folder Architecture”This chapter lives inside the usual demos layout. Shared assets live above the chapter.
Example (simplified):
Day07/styles/(shared:reset.css,brand.css,layout.css)scripts/(shared:ui.js)01-a-sip-of-gulp/src/(chapter source)dist/(build output)gulpfile.js
One-Time Global Install
Section titled “One-Time Global Install”Install the Gulp CLI globally (one-time per machine):
npm install --global gulp-cliQuick check:
gulp --versionProject Setup
Section titled “Project Setup”From inside the chapter folder (e.g., 01-a-sip-of-gulp/):
1) Initialize npm
Section titled “1) Initialize npm”npm init -y2) Install Gulp + Plugins
Section titled “2) Install Gulp + Plugins”Install everything needed for this demo pipeline:
npm install --save-dev gulp browser-sync gulp-concat gulp-terser gulp-clean-css gulp-htmlmin gulp-replace delWhat these do:
gulp: the task runnerbrowser-sync: dev server + hot reloadgulp-concat: concatenate filesgulp-terser: minify JavaScriptgulp-clean-css: minify CSSgulp-htmlmin: minify HTMLgulp-replace: rewrite build blocks in HTMLdel: reliable cleaning of thedist/folder
npm Scripts
Section titled “npm Scripts”Add these scripts to package.json:
{ "scripts": { "dev": "gulp", "build": "gulp build" }}Pipeline Tasks
Section titled “Pipeline Tasks”This demo defines a few core tasks:
- clean: wipe
dist/ - styles: pull shared + local CSS → concat/minify →
dist/assets/app.min.css - scripts: pull shared + local JS → concat/minify →
dist/assets/app.min.js - images: copy hero image(s) →
dist/images/ - html: rewrite CSS/JS build blocks → minify →
dist/*.html - serve: BrowserSync + watch + hot reload
Running the Demo
Section titled “Running the Demo”Dev mode (watch + hot reload)
Section titled “Dev mode (watch + hot reload)”npm run devProduction build (portable dist/)
Section titled “Production build (portable dist/)”npm run buildAfter a build, your dist/ folder should contain:
dist/01-a-sip-of-gulp.html(orindex.htmlif you use that convention)dist/assets/app.min.cssdist/assets/app.min.jsdist/images/…dist/LICENSE(if you copy it over)
What Just Happened
Section titled “What Just Happened”You didn’t write better code.
You didn’t change your app logic.
You changed the workflow.
Instead of relying on memory and discipline, you:
- defined steps once
- ran them consistently
- produced predictable output
That was the power of task runners.
The Cost of This Model
Section titled “The Cost of This Model”Notice what else appeared:
- configuration files
- plugin dependencies
- explicit glue code
- a separate “build mindset”
For a while, this tradeoff was acceptable.
As projects grew, it became friction.
⏭ The Cracks Appear
Section titled “⏭ The Cracks Appear”Pipelines worked.
But they were brittle.
As front-end applications became more dynamic and stateful, this model began to strain.
That pressure is what led to the next generation of tooling.
And that’s where we’re headed next.