the1sky / gulp-tutorial

Code examples for my Gulp.js tutorial series on

Home Page:http://stefanimhoff.de/tag/gulp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction to Gulp.js

Tutorial

These are the files for my series Introduction to Gulp.js published on my website stefanimhoff.de.

Tutorial Overview

  1. Intro and Setup
  2. Server with BrowserSync and Configuration
  3. Build, Clean and Jekyll
  4. Creating CSS with Sass (and Compass)
  5. Bundling JavaScript with Browserify
  6. Images and Vector Fonts
  7. Base64 Encoded Images
  8. Watch for Changes
  9. Checking the Syntax of SCSS and JavaScript
  10. Generating CSS Image Sprites
  11. Production Build, Server and Jekyll
  12. Optimize CSS, JavaScript, Images and HTML
  13. Revisioning
  14. Deploying the Website with Rsync
  15. Performance Improvements with WebP and Gzip
  16. PostCSS

Installation

Clone the repository on your computer and change into the projects folder. Run:

$ bundle
$ bower install
$ npm install

Hint: If you get errors while installing gulp-imagemin it may help to execute this command before running npm install:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

Hint: I recently ran into problem with gulp-imagemin. This may be an error with my current version of node. But if you get the same error on gulp publish, while optimizing images install manually these files:

$ npm install optipng-bin
$ npm install cwebp-bin

To install Fontcustom you should have Homebrew installed or use another package management tool to install the dependencies:

$ brew install fontforge --with-python
$ brew install eot-utils

Setup

Open gulp/config.js and change settings if needed. Only the rsync settings need to be adjusted. Change the destination to a path on your webserver and change hostname and username.

Running Gulp.js

Three tasks are available:

$ gulp
$ gulp publish
$ gulp deploy
  • Running gulp will start a development server, build assets and the Jekyll site and start a watch task.
  • Running gulp publish will copy and optimize assets and run a production build of Jekyll.
  • Running gulp deploy will copy the generated files with Rsync to your server.

Sass, Compass or PostCSS

The current version of this tutorial uses PostCSS. If you would like to use Sass (or Compass), you can still easily access the old code in the branch ruby-sass. The new code at the time I wrote the article is available in the branch postcss. Additionally I merge it into master and will process with PostCSS in my tutorial.

Credits

This tutorial includes some files for demonstation purposes:

About

Code examples for my Gulp.js tutorial series on

http://stefanimhoff.de/tag/gulp/


Languages

Language:JavaScript 48.4%Language:CSS 31.8%Language:HTML 15.2%Language:Ruby 4.5%