Deliver pure business automation.
An ES6 boilerplate with common frontend tasks using Gulp 4 as build system.
This is a work in progress. Feel free to contribute. For an older version without Gulp 4, see 0.6.1.
npm run deployNode (use brew or install it from here)
brew install nodeGulp (Getting started)
npm install -g gulpjs/gulp-cli && npm rebuild node-sass --force && npm install uglify-js -gOSX & Linux
git clone --depth 1 https://github.com/dmnsgn/gulp-frontend-boilerplate.git && cd gulp-frontend-boilerplate && rm -rf .gitWindows
git clone --depth 1 https://github.com/dmnsgn/gulp-frontend-boilerplate.git && cd gulp-frontend-boilerplate && rd /s /q .gitThis step sets up the boilerplate to fit your needs (App Name, JS compiler/transpiler, JS framework, CSS preprocessor). It should only be ran once.
npm run initThen each time you clone the repo, use:
npm installOpen package.json:
Option (directories and config keys) |
Type | Default |
|---|---|---|
| src: the source folder path, that's where you write code. | String | src |
| dist: the destination folder path, that's where your code is compiled. | String | dist |
test: the test folder path. |
String | test |
| verbose: provide a more verbose output when available (useful for debugging). | Boolean | false |
| port: the server port. | Number | 3000 |
| browsers: the browser(s) targeted for autoprefixer (see full list of options here) | Array | ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'] |
| prodURL: the absolute url to use in the sitemap and for metas | String | '' |
| shareImageURL: the absolute url of the share image for metas | String | '' |
| twitterHandle: twitter handle for metas | String | '' |
| analyticsUA: your google analytics UA | String | '' |
| developerURL: your URL. | String | '' |
Others keys:
This is the default task.
npm run devAll the magic begins here:
- process
.htmlfiles - process
.scss,.lessor.stylfiles - process
.jsor.coffeefiles - create a server with BrowserSync and serve
distfolder - watch changes in source folder
- reload on changes in source folder
Same as running gulp --env dev.
Note: if you just want to build the project and serve it, run npm run prod then gulp serve.
- Write your markup in
srcfolder and insrc/inc. Include your partials with<!-- @include inc/_filename.html --> - Add some
scss,lessorstylstyles. - Add some
scripts:.jsor.coffee. - Add images in the - wait for it -
imagesfolder. - Generate a spritesheet with corresponding mixins (located in
styles/_sprite{.scss,.less,.styl}) by adding.pngfiles intoimages/spritefolder and retina version with@2xsuffix.
When you are happy with your changes, run:
rm -rf dist/* && npm run prod- Replace build tags with
.minfiles, generates these minified files indistfolder (with optimization tasks) - Add copyright headers and generate a
sitemap.xmlfile
Quick tests and stats with:
# w3c validation
gulp testMarkup
# mocha tests (written in test folder)
gulp testScripts
# PageSpeed Insights reporter for mobile and desktop
gulp testPsiClean dist dir (except static folder) and clear all caches (sass cache, gulp cache)
gulp cleanThis command will give you a list of all tasks available and their description.
gulp --tasks- On some OS, napa needs to be installed globally first
npm install -g napa
MIT