Gulp + Nunjucks Automation: Modern Frontend Build Workflow

Hi! I'm a Frontend Developer from Istanbul. I like π cats, π± plants, π΅ music, π¨ art, π sci-fi and anything that empowers the imagination.
Iβve always loved clean, maintainable workflows β the kind where everything just works.
But after years of trying modern bundlers, frameworks, and endless plugins, I kept coming back to Gulp β simple, flexible, and surprisingly future-proof. Especially for smaller vanilla javascript projects.
So I decided to build my own starter:
A fully automated frontend workflow using Gulp 5 , Nunjucks , and SCSS , designed for developers who want control and clarity β not a black box.
To install and use, go to repo.
You can find the full documentation here.
π Why I Built This
Modern frontend tools can feel heavy and fragile.
You install 50 dependencies, and suddenly your build breaks because one library changed its syntax.
I wanted something lightweight , modular , and predictable β a workflow you can understand at a glance and maintain for years.
Thatβs what this setup gives you:
Simple folder structure
Task-based build pipeline
Clear file injection logic
And no mysterious magic β just code you can actually read.
β¨ Features at a Glance
β Gulp 5 task runner (modernized & async-ready)
β Nunjucks templating with partials and data files
β SCSS + PostCSS for clean, autoprefixed CSS
β Babel to transpile modern JavaScript
β BrowserSync for instant live reload
β SVG to icon font generator β no manual Unicode naming
β Readable, modular task files β perfect for learning Gulp
Tested on Node.js 22.20.0 β use this version (via .nvmrc) for maximum compatibility.
π Folder Structure
Hereβs a quick overview of how everything is organized:
src/
β£ data/
β£ icons/
β£ js/
β£ scss/
β β£ base/
β β£ components/
β β£ pages/
β β£ vendors/
β β main.scss
β£ tasks/
β templates/
β£ includes/
β β£ components/
β β layout/
β pages/
β index.njk
dist/
β£ assets/
β β£ css/
β β£ fonts/
β β β icons/
β β£ images/
β β js/
β index.html
πΌοΈ Important:
Youβll need to manually add your images and fonts into dist/assets/images and dist/assets/fonts.
π§© Getting Started
- Clone the repository:
git clone https://github.com/serhatbek/gulp-nunjucks-template.git ./my-project
cd my-project
- β‘ Install and use node.js v22.20.0 to ensure long-term stability. If nvm is installed and you already have v22.20.0, you can:
nvm use
The .nvmrc file in the project specifies the correct Node.js version.
- βοΈ Change the project name in the
package.jsonfile to your project name. This is important because later Gulp will inject JS and CSS files automatically using your project name.
From this:
{
"name": "gulp-nunjucks-template",
"version": "1.0.0",
"main": "gulpfile.js",
}
To whatever your project name is:
{
"name": "my-project",
"version": "1.0.0",
"main": "gulpfile.js",
}
- π¦ Install dependencies
npm install
- π Start development server
npm run dev
This will:
π§Ή Clean the build folders (except 'dist/assets/images' and 'dist/assets/fonts')
π Compile SCSS and JS
π€ Generate font icons from SVG files
πΌοΈ Render Nunjucks templates
π Start live-reloading browser
π‘ Best Practices
Use Node.js 22.20.0 for maximum compatibility
Run npm run icons whenever you add, remove, or rename an SVG icon
Structure your SCSS and templates modularly (base/, components/, layouts/)
Use nvm or .nvmrc to lock Node version across systems
π§© Troubleshooting
| Problem | Solution |
| Build fails or icons missing | Check for invalid or corrupted SVGs insrc/icons/ |
| Icons not displaying | Runnpm run icons again after changing icons |
| Live reload not working | Ensurenpm run dev is running and not blocked by firewall |
| Styles not updating | Confirm your SCSS files are saved and insidesrc/scss/ |
Made with β€οΈ for reusability.
Thank you for reading. If you find the article useful, please do not forget to like and comment so that others can access it. If you're on a generous day, you can even buy me a coffee. π



