A simple workflow for static websites with live-reload local server, Babel transpiler for JavaScript and bundling CSS with PostCSS and CSSNext.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Static Web Build Dependencies

A simple workflow for static websites with live-reload local server, Babel transpiler for JavaScript and bundling CSS with PostCSS and CSSNext.

🌍 https://staticbuild.website/

Features ⚡️

  • Processing styles using PostCSS with postcss-preset-env
  • Babel Transpiler for JavaScript (ES6)
  • JavaScript Concatenating and Minification
  • CSS Minification
  • HTML Minification
  • Image Compression
  • Asset Copying
  • Templating & Partial HTML Injection
  • Cache-Busting
  • Server for viewing built site
  • Live-Reload for the dev environment
  • Creates app/ directory with built content and assets

Setup ⚙️

This project requires node version 7.5+. This is the only global dependency.


$ npm install

Development 👾

To start the development server just run the dev task:

$ npm run dev

This will start the development server. The server is based on browserSync, supports live reloading which enables hot swapping of CSS styles without reloading the page.

Have fun ✌️


Templating ✍️

To avoid repetitive HTML code the build uses gulp-file-include, it allow us to re-use chunks of code written in separate files. It is recommended to place the included files in the /src/includes directory to keep track of changes and live-reload.

Simple Include


Include with Parameters

@@include('./includes/helmet.html', {
	"title": "Static Web Build"



If Statement

	"menu": true




	@@loop(‘./includes/loop-article.html’, [
		{ "title": "My post title", "text": "<p>lorem ipsum...</p>" },
		{ "title": "Another post", "text": "<p>lorem ipsum...</p>" },
		{ "title": "One more post", "text": "<p>lorem ipsum...</p>" }



File Structure 🏗

├── app/                     # Distribution files
├── src/                     # Source files
│   ├── assets/              # Assets directory
│       ├── img/             # Image directory
│       ├── fonts/           # Fonts directory
│       ├── js/              # JavaScript files
│       ├── styles/          # CSS files
│   ├── etc/                 # Additional build files
│   ├── includes/            # Included partials
├── tools/                   # Tools and utilities
│   ├── stylelintrc.json     # Stylelint configuration file
│   ├── IntelliJ.xml         # IntelliJ code style
└── .babelrc                 # Babel configuration
└── .gitignore               # Git ignored files
└── gulpfile.js              # Gulp configuration
└── LICENSE                  # License agreements
└── package.json             # Node packages
└── README.md                # You are reading this

Note: Your project files: src/

Production 🎬

To build the production files run the prod task:

$ npm run prod

The files will be generated in the app/ directory. The production build automatically minifies the html and css. By default also the javascript files are concatenated in one bundle: assets/js/bundle.js.

Image Optimization 🌅

For image optimization and SVG compression run:

$ npm run images


Note: The Gulpfile.js requires a build restart for any changes to take effect.

PostCSS Plugins 🎨

Currently, PostCSS has more than 200 plugins. You can find all of the plugins in the plugins list or in the searchable catalog. CSSNext is installed in the default configuration.

/* -------------------------------------------------------------------------------------------------
PostCSS Plugins
------------------------------------------------------------------------------------------------- */
var pluginsDev = [
var pluginsProd = [

JavaScript Files

JavaScript files located in the project source directory src/assets/js/ and are automatically concatenated and included in the build process. However you can add additional / external JavaScript libraries by including the files in the Gulp configuration.

/* -------------------------------------------------------------------------------------------------
    Your JavaScript Files
------------------------------------------------------------------------------------------------- */
var headerJS = [
var footerJS = [

The headerJS is included before the DOM is loaded and it does not use Babel for transpiling JavaScript. The footerJS is included after the DOM is loaded, and it goes thourgh Babel.

Technologies 🚀

  • NodeJS
  • Gulp
  • browserSync
  • Babel
  • PostCSS
  • CSSNext

Codestyle and Quality Assurance ⚔️

The static web build repository comes with its own set of code style rules that can be imported into IntelliJ. The codestyle file can be found here: tools/IntelliJ.xml

It is advised to run the command $ npm run lint:css before pushing changes, to make sure the codestyle is consistent!

License ⚖️




  • Added support for static server using Express.
  • Switched from postcss-cssnext to postcss-preset-env.


  • Fix IE animation keyframe minification.


  • Update dependencies.
  • Code legibility.


  • HTML Templating with gulp-include.
  • Bugfixes & speed improvements.


  • Initializing Static Web Build.