Add the required npm packages to your site, by running yarn add --dev gulp sites (or npm install --save-dev gulp sites if using npm rather than Yarn).
Create basic directory structure:
assets for any static files that do not need any processing (images, web fonts, etc).
css for SASS files. These are compiled into the _output/css directory.
Create gulpfile.js with the following contents:
const gulp = require ( 'gulp' );
const sites = require ( 'sites' );
sites. installTasks (gulp); copy
Build static HTML files, referencing CSS files from _output/css:
<! DOCTYPE html >
< html >
< head >
< title > Hello world! </ title >
< link href = "_output/css/main.css" rel = "stylesheet" >
</ head >
< body >
< h1 > Hello world! </ h1 >
</ body >
</ html > copy
Run gulp serve to open the site in your browser. This uses BrowserSync, so any edits to the CSS or HTML files will automatically refresh the browser!
Configure CSS combination by adding some comments to the HTML file:
<!-- build:css css/combined.css -->
< link href = "_output/css/main.css" rel = "stylesheet" >
<!-- endbuild --> copy
Run gulp build to build the production version of the site. The _output directory is now fully optimized and ready to push to production!