From a3f9651982a549080253b67fd15e9868ea777a8a Mon Sep 17 00:00:00 2001 From: Jordan Scales Date: Tue, 21 Apr 2020 12:37:59 -0400 Subject: [PATCH] basic template setup --- .gitignore | 2 ++ build.js | 22 ++++++++++++++++++++++ docs/{index.html => index.html.ejs} | 8 ++++---- package-lock.json | 14 ++++++++++++++ package.json | 8 ++++++-- 5 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 build.js rename docs/{index.html => index.html.ejs} (94%) create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58db40d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +docs/index.html +node_modules/ diff --git a/build.js b/build.js new file mode 100644 index 0000000..af4746f --- /dev/null +++ b/build.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +const ejs = require("ejs"); +const fs = require("fs"); + +let id = 0; +function getNewId() { + return ++id; +} +function getCurrentId() { + return id; +} + +function buildDocs() { + const template = fs.readFileSync("./docs/index.html.ejs", "utf-8"); + + fs.writeFileSync( + "./docs/index.html", + ejs.render(template, { getNewId, getCurrentId }) + ); +} + +buildDocs(); diff --git a/docs/index.html b/docs/index.html.ejs similarity index 94% rename from docs/index.html rename to docs/index.html.ejs index f01b26c..0fc0bb3 100644 --- a/docs/index.html +++ b/docs/index.html.ejs @@ -166,8 +166,8 @@

- - + +
Show code @@ -188,8 +188,8 @@
- - + +
diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f03891b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "98.css", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ejs": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.0.2.tgz", + "integrity": "sha512-IncmUpn1yN84hy2shb0POJ80FWrfGNY0cxO9f4v+/sG7qcBvAtVWUA1IdzY/8EYUmOVhoKJVdJjNd3AZcnxOjA==", + "dev": true + } + } +} diff --git a/package.json b/package.json index e0d7f77..cb580a6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "doc": "docs" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "build": "./build.js" }, "repository": { "type": "git", @@ -22,5 +23,8 @@ "bugs": { "url": "https://github.com/jdan/windows98.css/issues" }, - "homepage": "https://github.com/jdan/windows98.css#readme" + "homepage": "https://github.com/jdan/windows98.css#readme", + "devDependencies": { + "ejs": "^3.0.2" + } }