Gulp

Gulp is a tool that helps you out with several tasks when it comes to web development.

Installing Gulp

You need to have Node.js (Node) installed onto your computer before you can install Gulp.

If you do not have Node installed already, you can get it by downloading the package installer from Node's website.

When you're done with installing Node, you can install Gulp by using the following command in the command line:

When you’re done, make sure you’ve installed the rest of the theme’s dependencies:

Now, we can run this task with the gulp command in the command line.

We've also built a second task, build, that creates a dist folder for the production website. To run this task, we just have to type gulp build into the command line.

Using Nunjucks with Gulp

We have used Nunjucks through a plugin called gulp-nunjucks-render

public/
    ├── pages/
    ├── templates/
        ├── partials/
        └── layout.html
    

The templates folder is used for storing all Nunjucks partials and other Nunjucks files that will be added to files in the pages folder.

The pages folder is used for storing files that will be compiled into HTML. Once they are compiled, they will be created in the project root.

We created a template that contains boilerplate HTMl code which can be inherited by other pages. In this boilerplate HTML layout.html.

Complete Reference