Splitting up our Harp project into partials
In this recipe, we will split our existing project into partials, to keep our code DRY. Harp uses Embedded JS (EJS) format for includes. For more information on .ejs
, visit http://www.embeddedjs.com/.
To begin, we can either continue from the previous recipe or clone the available repository for the recipe from the link https://github.com/ImsirovicAjdin/bootstrap4-with-sass-harp-grunt.
It is assumed in this recipe that you are using Cloud9 IDE. However, if that is not the case, then do not include the reference to workspace
in commands to be run, as that folder is Cloud9-specific.
How to do it...
- In
workspace/app
, add a new folder and call itpartial
:
cd && cd worspace/app && mkdir partial
- Add
_nav.ejs
to thepartial
folder--touch partial/_nav.ejs
. - Open the
app/index.html
and cut all the code starting with<nav>
and ending with</nav>
(the wholenavbar
). Paste the code into the_nav.ejs
file. - In
index.html
, right where...