Gulp-based build tool with Pug, Sass, Rollup, PostCSS, BrowserSync
- Install Node.js >=16
- Install gulp-cli globally
npm install --global gulp-cli
- Download this repo using git
git clone https://github.com/orlovmax/gulp-workflow.git
- Go to downloaded folder
cd gulp-workflow
- Install dependencies from
package.json
by running:npm install
- Start development by running
npm start
orgulp
- See Tasks and Configuration for more details
If you haven't used Gulp before, be sure to check out the Gulp - Getting Started.
./
├── .editorconfig
├── .gitignore
├── gulpfile.js
├── package.json
├── README.md
├── LICENSE.md
|
├── gulp/ * gulp tasks
| ├── _config.js * tasks config
| └── task.js
|
├── src/ * site source
| ├── pug/ * pug templates
| | ├── blocks/ * blocks
| │ | └── block.pug
| │ ├── helpers/ * helper mixins
| │ ├── vendor/ * third-party code
| │ ├── layouts/ * page layouts
| │ ├── pages/ * page templates
| │ └── config.json * site config
| │
| ├── sass/ * sass stylesheets
| | ├── blocks/ * blocks
| │ | └── block.sass
| │ ├── helpers/ * mixins and vars
| │ ├── vendor/ * third-party code
| │ ├── custom.sass
| │ ├── noscript.sass
| │ └── screen.sass
| │
│ ├── js/ * scripts
| | ├── vendor/ * third-party code
| | ├── modules/ * modules
| │ ├── head.js * head scripts
| │ └── body.js * body scripts
| │
│ ├── fonts/ * font sources
| │
│ ├── images/ * image sources
| │
│ └── helpers/ * helper files
│ └── favicon.ico
|
├── build/ * site build
│ ├── index.html
│ ├── page.html
│ └── static/ * static assets
│ ├── css/ * compiled stylesheets with sourcemaps
│ ├── js/ * bundled scripts
│ ├── fonts/ * webfonts
│ └── images/ * images
│
└── dist/ * site distribution (Ignored by GIT)
├── index.html
├── page.html
└── static/ * static assets
├── css/ * minified compiled stylesheets
├── js/ * minified bundled scripts
├── fonts/ * webfonts
└── images/ * images
html
, css
, stylus
, videos
folder names in src
are reserved by preconfigured inactive tasks, see Inactive Tasks.
.editorconfig
file at the root of the project describes indentation style, trailing whitespaces etc. See EditorConfig site for more details.src/pug/config.json
contains data for pug templates: site settings, meta information, links to css / js files or external fonts.
npm run cleanup
or gulp cleanup
- Removes .gitkeep placeholders from work directories.
npm start
or npm run dev
or gulp dev
- Compiles pug templates
- Compiles sass stylesheets, combines media queries, adds vendor prefixes, generates sourcemaps
- Bundles scripts
- Copies fonts
- Copies images
- Copies helpers
- Runs BrowserSync static server with live reload
- Watches for changes and run dev tasks
npm run prod
or gulp prod
- Empties
dist
folder - Compiles pug templates, minifies markup
- Compiles sass stylesheets, combines media queries, adds vendor prefixes, minifies stylesheets
- Bundles scripts, minifies scripts
- Copies fonts
- Copies images
- Copies helpers
- Runs BrowserSync static server
npm run demo
or gulp demo
\
- Runs static server.
Preconfigured tasks but disabled in current version (commented-out and not imported), see gulpfile.js and watch.js.
html (html.js)
Dev: copies html markup
Prod: copies and minifies html markup
How To Activate:
- uncomment
import { htmlDev, htmlProd } from './gulp/html.js';
section ingulpfile.js
- add
htmlDev
todev
andhtmlProd
toprod
series ingulpfile.js
- uncomment
import { htmlDevChanged } from './html.js';
andWatch HTML
sections in./gulp/watch.js
- create
html
folder insrc
./ └── src/ └── html/ * html markup └── file.html
css (css.js)
Dev: copies css stylesheets, inlines imports, combines media queries, adds vendor prefixes
Prod: copies css stylesheets, inlines imports, combines media queries, adds vendor prefixes, minifies stylesheets
How To Activate:
- uncomment
import { cssDev, cssProd } from './gulp/css.js';
section ingulpfile.js
- add
cssDev
todev
andcssProd
toprod
series ingulpfile.js
- uncomment
import { cssDev } from './css.js';
andWatch css
sections in./gulp/watch.js
- create
css
folder insrc
./ └── src/ └── css/ * css stylsheets ├── blocks/ | └── block.css ├── helpers/ ├── vendor/ ├── custom.css ├── noscript.css └── screen.css
stylus (stylus.js)
Dev: compiles stylus stylesheets, combines media queries, adds vendor prefixes, generates sourcemaps
Prod: compiles stylus stylesheets, combines media queries, adds vendor prefixes, minifies stylesheets
How To Activate:
- uncomment
import { stylusDev, stylusProd } from './gulp/stylus.js';
section ingulpfile.js
- add
stylusDev
todev
andstylusProd
toprod
series ingulpfile.js
- uncomment
import { stylusDev } from './stylus.js';
andWatch stylus
sections in./gulp/watch.js
- create
stylus
folder insrc
./
└── src/
└── stylus/ * stylus stylesheets
├── blocks/
| └── block.styl
├── helpers/
├── vendor/
├── custom.styl
├── noscript.styl
└── screen.styl
videos (videos.js)
Dev / Prod: copies videos
How To Activate:
- uncomment
import { videosDev, videosProd } from './gulp/videos.js';
section ingulpfile.js
- add
videosDev
todev
andvideosProd
toprod
series ingulpfile.js
- uncomment
import { videosDevChanged } from './videos.js';
andWatch videos
sections in./gulp/watch.js
- create
videos
folder insrc
./
└── src/
└── videos/ * video sources