Gulp

A brief explanation of the gulpfile provided with Fastland theme.


Build, Serve and Watch: gulp

Running gulp in the terminal or command line will compile the sources to dist then start a local Browsersync instance on port 4001 to serve and refresh your pages as you edit.

The default task runs the following operations:

  • clean: Gulp deletes the dist folder. All files in dist are erased.
  • html: All .html files are copied and .njk files are compiled from app to dist.
  • scss: Compiles main.css and settings.css from app/scss/ to the dist/css along with appropriate .map files.
  • copy-assets: Copies static files or assets from app to dist directory, such as fonts, images, plugins, javascript.
  • browserReload: Starts a Browsersync instance on port 4100 served from dist, defaults to index.html.
  • watchFiles: Monitors the following files and runs the corresponding tasks when anything is added, modified or deleted:
    • app/*.html and app/*.njk, then runs the html task.
    • app/scss/*.scss, then runs the scss task.
    • app/*.*: then runs the copy-assets task.
    • After copying or replacing all new or modified assets or deleting the deleted ones, gulp runs the browserReload task.
    • Continues watching for changes.