Giter VIP home page Giter VIP logo

gulp-prototyping-starter's Introduction

โš  This project is now archived. The dependencies are very out-of-date - proceed with caution! โš 

gulp-prototyping-starter

Quick-start project for rapid prototyping in the browser, using node, gulp, and Ruby (for Sass compilation).

I wanted to create a starting point for new web projects. It makes designing in the browser a lot smoother by watching my source files and automatically reloading the browser when they change. Sass files are compiled into CSS (it includes my preferred normalize/reset CSS as a partial) and JavaScript files are concatenated to minimise browser requests. Both CSS and JS files are linted to avoid errors and keep code consistent and clean. Finally and optionally, it'll generate an optimised version of the site with minimised CSS and JS, and optimised image files.

Features

  • Generates CSS from Sass files, with sourcemaps and linting
  • Concatenates JavaScript files, with sourcemaps and linting
  • Watches files for changes and automatically reloads the browser
  • Uses modular gulp tasks with config file for easy customisation of the build process
  • Optionally, get the site ready for deployment with CSS and JS minification and image optimisation

Installation

1. Install these:

  • Ruby. Tested with version 2.2.4. I suggest using RubyInstaller on Windows (make sure to check the option to add Ruby executables to your PATH).
  • Node.js Tested with version 0.12.5. On Windows, make sure you choose the option to add to PATH.
  • LiveReload browser extension for Chrome, Firefox and Safari

Check everything's working:

Open a new command line window and enter the following:

ruby -v
node -v
npm -v

If Ruby, Node and the node package manager are installed correctly, you'll get version numbers for each.

2. Open a command line and run these:

On Windows, do this as an administrator. I also recommend ConEmu as a much-improved upgrade from the built-in cmd.

  • gem install bundler - installs Bundler, which lets you manage Ruby gems
  • bundle install - uses Bundler to quickly install all of the Ruby dependencies as defined in the Gemfile - here, the sass and scss_lint gems
  • npm install gulp -g - uses the node package manager to globally install gulp on your machine - a requirement for running gulp locally
  • npm install - uses the node package manager to install all of our gulp project dependencies, as defined in package.json

Using gulp-prototyping-starter

Run the main gulp task

Type gulp into your command line.

This is the default development task. It will do the following:

  • delete the existing build/development directory
  • start watching files in the src directory for changes
  • start Browsersync
  • copy html/htm/xml/json/txt files anywhere in src to build/development
  • compile Sass files in src/scss into build/development/css/main.css, add vendor prefixes for older browsers, generate a source map, and lint
  • concatenate JavaScript files in src/js into build/development/js/scripts.js, generate a source map, and lint
  • copy image files anywhere in src into build/development
  • launch a new browser window and serve index.html at http://localhost:9999

Now that it's watching your src directory, any changes to files therein will automatically reload your browser window, which is ideal for efficient development.

To quit the process and stop watching files, hit CTRL-C (CMD-C on a Mac) twice.

Run the publish command

Type gulp publish into your command line.

This is the publish task. It will do the following:

  • delete the existing build/production directory
  • copy any html/htm/xml/json/txt files from src to build/production
  • compile Sass files in src/scss into build/production/css/main.css, add vendor prefixes for older browsers, generate a source map, and minify
  • concatenate JavaScript files in src/js into build/production/js/scripts.js, generate a source map, and minify
  • copy image files anywhere in src into build/production and optimise them for web

The process will then end and you will be left with an optimised site in build/production. It doesn't watch files or lint your CSS/JS, as I assume this is done during the development process.

gulp-prototyping-starter's People

Contributors

rhianvanesch avatar

Watchers

 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.