Neglected Puppy Market


    1.0.1 • Public • Published


    ejs-static-converter allows you to convert a node app that uses the EJS templating engine into a static HTML site, independant from any server code. This is useful for converting apps or websites that were made with node and ejs for easier development but don't require any server-side code into static HTML.

    The package will also render any ejs include functions like below into the HTML package, such as a header, navbar etc. into the new HTML file.

        // Include the header HTML which contains universal tags, references and other metadata.
        <%- include("indexHeader.ejs") -%>

    Installing the package

    express and ejs are requirements for this package to work, as the site needs to be setup using the templating engine

    npm i express ejs
    npm i ejs-static-converter

    A /public and /views folder should be created in your project's root folder to contain the .ejs views and any public files such as CSS, images etc.

    When the convert function is run, all html files will be created inside their own directory in the /public folder so all file references still work with the exception of the index.ejs file.

    Example 'server.js' file:

    // Main dependencies
    const express = require("express");
    const app = express();
    const server = require("http").Server(app);
    // References
    const ejs = require("ejs");
    var fs = require("fs");
    const convertToStatic = require("ejs-static-converter")
    // Declare ejs, JSON formatting and set static files folder.
    app.set("view engine", "ejs");
    app.set("json spaces", 2);
    // Home
    app.get("/", (req, res) => {
    // Page 2
    app.get("/page-2", (req, res) => {
    // Initialise the server on port 3000.
    // Convert to static site
    // List the names of all .ejs files in the '/views' directory.
    const pages = ["Index", "Page-2"]
    // Run the function
    // If you don't need the function, comment it out so it doesn't convert your site when you don't need it.
    // convertToStatic(pages)


    If you wan't to make a change or improvement, open a pull request or suggest a feature/bug as an issue.


    npm i ejs-static-converter

    DownloadsWeekly Downloads






    Unpacked Size

    69 kB

    Total Files


    Last publish


    • thamiltonsmith1