Awesome Open Source
Awesome Open Source

Pug-Sass Boilerplate Starter Kit

Pug-Sass Boilerplate Starter Kit is a Front-end web kit and boilerplate for building web apps or small sites using Pug(Jade) and Sass


This project is based on a simple and fast workflow focused mainly on the front-end task. It gives a solid starting point for newcomers who wants a ready-to-deploy local environment setup. The sources used to build this project includes:


  • Pug-Sass ready.
  • Easy to deploy your production files
  • Performance optimization: minify and concatenate JavaScript, CSS, HTML and images
  • Live browser reloading with BrowserSync
  • Includes:



Getting Started

After Node.js, npm, Gulp and Bower(optional) installation, you can create a new project based on pug-sass-boilerplate-starter-kit by doing the following:

Install From Source

First, clone the project:

$ git clone <my-project-name>

Initialize npm on <my-project-name> directory

$ cd <my-project-name>
$ npm init

Install Gulp locally

$ sudo npm install gulp --save-dev

Finally, install Gulp required dependencies

$ sudo npm install gulp-uglify browser-sync gulp-plumber gulp-autoprefixer gulp-sass gulp-pug gulp-imagemin gulp-cache gulp-clean-css gulp-sourcemaps gulp-concat beeper gulp-util gulp-rename gulp-notify --save-dev

get start demo gif

Optionally, if you want to add external components and libraries, initialize Bower and install the dependencies to be used in your next project (e.g.: jQuery, Bootstrap, Modernizer).

$ bower init
$ bower install jquery --save
$ bower install bootstrap --save

Running Your Local Server With Gulp

After the installation of all requirements and its dependencies, your local web development environment is ready to run. Setup your initial files with gulp setup. This command is only necessary the first time the project is set or if the build folder is deleted.

$ gulp setup

Now run your local server using the watch task

$ gulp watch

This task will open the browser window usually with the URL http://localhost:3000/. Any saved changes made to the project files, will reload automatically the browser.

gulp task demo gif

Project Structure

The structure presented in this boilerplate is grouped primarily by folder content and file type. Please note that this structure is only meant to serve as a guide, it is by no means prescriptive.

├── build/                      # Store processed/minified files - your project's deployable output
├── img/                        # Main folder for image files
├── js/                         # Main folder for JS files
│   ├── vendor/                 # Store third part library files (e.g.: jquery, bootstrap)
│   └── main.js                 # Index JS code goes here
├── styles/                     # Main folder for cascade style files
│   ├── modules/                # Store third party modules and initializers (e.g.: normalize, reset)
│   ├── variables/              # Store sass variables files
│   └── main.scss               # Index Sass goes here
├── templates/                  # Main folder for pug template files
├── .bowerrc                    # Change bower library destination path from its default
├── gulpfile.js                 # Setup Gulp tasks
└── index.pug                   # Index pug markup goes here

The build/ Contents

├── build/
    ├── img/                    # Contains the compressed and optimized image files
    ├── css/                    # Contains the concatenated/minified .css files and .map files
    ├── js/                     # Contains the concatenated/minified/uglyfied .js files and .map files
    │   └── vendor/             # Store third party libraries
    └── index.html              # Minified html index file

The Gulp plugins

  • Autoprefixer : Write CSS rules without vendor prefixes.
  • beeper : Beeps when an error happens.
  • BrowserSync : Keep multiple browsers in sync after file save.
  • cache : Keeps an in-memory cache of files images so only changed images are compressed with Imagemin plugin.
  • clean-css : CSS optimizer and minifier.
  • concat : Concatenates .js files into bundle.js.
  • imagemin : Minify PNG, JPEG, GIF and SVG images.
  • notify : Send error messages to Mac Notification Center, Linux notifications or Windows >= 8.
  • plumber : Prevent pipe breaking caused by errors from gulp plugins.
  • Pug : Compile your Pug templates into HTML.
  • rename : Rename minified files adding .min suffix.
  • SASS : Compile your SASS or SCSS into CSS.
  • sourcemaps : Create CSS and JavaScript map files to debug the code within compressed files.
  • uglify : Minify JavaScript files.
  • gutil : Log the error message with red highlighting for easier reading.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,301
boilerplate (638
sass (469
gulp (201
pug (97
development-environment (53
task-runner (49
webkit (39
jade (24
local-development (21