Git Product home page Git Product logo

pigeon-site's Introduction

Pug Boilerplate

A boilerplate setup for projects using Gulp to compile Pug into HTML and Sass into CSS, while also optimizing images and managing JavaScript files with Webpack.

Getting Started

Note: This is a template repository. New projects using this repo as a template should be created using the "Use this template" button above the file list on GitHub.

Dependencies

  • Node & npm
  • Gulp 4

Installation

  1. If you haven't already, use nvm to install node and npm
  2. If you haven't already, globally install the gulp command line tools: npm install --global gulp-cli
  3. Clone this repo or use it as a template
  4. In the project folder, install the node package dependencies: npm install

Development

Run the default Gulp task (gulp or gulp default) in the project root to compile all files, watch for future changes, and start up Browsersync.

Gulp Tasks Overview

1. Pug Compilation (pugCompile)

  • Compiles .pug files from src/pug/views/ into .html
  • Beautifies HTML output
  • Handles URL building
  • Outputs to docs/ directory
  • Triggers Browsersync reload on changes

2. Sass Compilation (sassCompile)

  • Compiles .sass, .scss, and .css files from src/scss/, excluding partials (files starting with _)
  • Applies autoprefixer for cross-browser compatibility
  • Minifies CSS
  • Outputs to docs/css/ directory
  • Triggers Browsersync reload on changes

3. JavaScript Bundling (jsBundle)

  • Bundles JavaScript files using Webpack (configured in webpackOptions)
  • Outputs to docs/js/ directory
  • Triggers Browsersync reload on changes

4. Image Optimization (imagesCompile)

  • Optimizes images from src/images/ using gulp-imagemin
  • Outputs to docs/images/ directory
  • Triggers Browsersync reload on changes

5. Browsersync (sync)

  • Serves compiled files from docs/ directory
  • Automatically reloads browser on file changes

6. Watch Tasks

  • pugWatch, sassWatch, jsWatch, and imagesWatch watch for changes in their respective file types and trigger the corresponding compile/bundle tasks

7. Exported Tasks

  • exports.pug, exports.sass, exports.js, and exports.images allow running individual tasks from the command line using gulp [taskName]
  • exports.build runs pugCompile, sassCompile, jsBundle, and imagesCompile in parallel
  • exports.watch runs all watch tasks in series
  • exports.default runs exports.build, exports.watch, and sync in series, and is the task that runs when gulp is used without arguments

Usage

  • Use gulp for development, which will compile all assets, start Browsersync, and watch files for changes
  • Use gulp build to compile all assets without starting Browsersync or watching files
  • Use gulp [taskName] to run individual tasks as needed (e.g., gulp pug or gulp images)

pigeon-site's People

Contributors

catherineriver avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.