Skip to content
Build a static website from EJS templates
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This project uses ejs to allow building a static website from modular ejs (HTML) files.
It's using ejs because you won't need to learn a new language, only a few new tags.
More info on ejs here


Install using the following commands

git clone
cd modularhtml
npm install


Build your website in the src folder. The page templates should go in src/pages. The partials, such as the head and tail, should go in src/partials.


To develop the website, this app uses a simple express server. You can run the server using npm start.


Linking to another file is the same as you would in a static html file, so link to /index.html and not to /index, because that won't work after compiling.

CSS preprocessor

You can use your own css preprocessor if you so desire. Just make sure changes in your source file are being watched and compiled a css file and make sure it's linked in head.ejs. Otherwise changes won't show up or be included in the compiled website.
CSS is minified on build.

JS minify/transpile

You can use your own js transpiler if you so desire. Just make sure it's compiled and linked in tail.ejs before compiling the website.
JS is minified on build.

New page

To create a new page use npm run newpage pagename. Where pagename would be the name of your page. This creates a new template with the head and tail already linked.

Build the website

If you are done you can build the website using npm run build. This will copy the assets folder to a newly created public folder. It also compiles the ejs templates and creates an html file in the public folder.

You can’t perform that action at this time.