sf on $10
-this was so not real i can't believe technically u paid for our first meal back. calmluh 3 years after. first hang !!!! pork buns were yummy 7/10
-diff --git a/README.md b/README.md index f3d40a6..72b81ce 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,26 @@ The site is based on the HTML5 UP Lens template and currently ships as a plain s ## Repo Layout -- `index.html`: main gallery page +- `templates/index.html`: source template for the main gallery page +- `index.html`: generated static gallery page - `assets/`: site CSS, JavaScript, fonts, and audio - `images/fulls/`: full-size gallery images - `images/thumbs/`: gallery thumbnails - `data/meals.json`: source of truth for gallery entries -- `scripts/render-gallery.js`: regenerates the gallery markup in `index.html` from `data/meals.json` +- `scripts/build.js`: renders static pages from templates and data +- `package.json`: minimal Node build entrypoint ## Content Workflow -Gallery entries now live in `data/meals.json`. +Gallery entries live in `data/meals.json`, and `index.html` is generated from `templates/index.html`. -After editing that file, regenerate the static markup with: +After editing content or templates, rebuild the site with: ```sh -node scripts/render-gallery.js +npm run build ``` -The script updates only the generated gallery block inside `index.html`. +The build currently renders the main page without changing the existing Lens gallery structure, so the current client-side viewer code continues to work. ## Image Conventions diff --git a/index.html b/index.html index 633e235..2557b15 100755 --- a/index.html +++ b/index.html @@ -1,222 +1,220 @@ - - - -
-
- Please enable javascript >.<
-this was so not real i can't believe technically u paid for our first meal back. calmluh 3 years after. first hang !!!! pork buns were yummy 7/10
-the first thing you cooked for me ! so yum 10/10
-we fucking love this place 10/10 i love poke i should have never quit pokehouse
-for our santa cruz hang! u in my city now. so so good but lwk so so tax 9/10
-better than pepper lunch. server was being a little bitchy but i would be too if i was the only one working the front. 8/10
-omfg this is my favorite thing uve made 100/10
-and then we played bananagrams. sushi 8/10 thanks for paying mommy
-main street tino nothing special 7/10
-my peoples food. 9/10
-insane safeway hang 9/10
-this fuckass blue drink
-one of many.. 100/10
-this is the plaza where i used to go to all the time before school 9/10
-mac and cheese was gas. 10/10. you know its my fav comfort food. free the girl crying in the corner tho
-spartan tacos
-okay damn no way we got this b2b
-this is lowkey the spot poke always hits so fucking good
-hobags ughgmmfmfm im such a fucking ho for hobags 100/10
-carmel by the sea! we love sushi but tax 8/10
-sweet treat -> claire dropping the most insane piece of information ever -> hti the yap
-so good and soooo filling 10/10. also my peoples food.
-even when its rich white people breakfast im getting salmon nox 10/10
-1k cal meal 0 protein 10/10
-i dont want to talk about this. 9/10
-i can't believe u didnt eat ur leftovers. 10/10
-for my birthday!! i love eating meat and i love you so perfect combination 1000/10
-why was the store so nice. i wonder about the 4 sisters
-her boyfriend is so not real hes so stupid and funny. porridge was gas too i love eating free at julias 10/10
-spartan tacos. i was moody lol.
-i helped wrap the wontons w/ u !!! super fun and super yummy 10/10
-marry me? yes. 100/10 best valentines day ever
-poke house 3 years later 9/10 but +1 point bc its basically free
-mochi yinje black milk tea ts was actually so buss 10/10 only boba i've ever wanted to get again myself
-
+ Please enable javascript >.<
+this was so not real i can't believe technically u paid for our first meal back. calmluh 3 years after. first hang !!!! pork buns were yummy 7/10
+the first thing you cooked for me ! so yum 10/10
+we fucking love this place 10/10 i love poke i should have never quit pokehouse
+for our santa cruz hang! u in my city now. so so good but lwk so so tax 9/10
+better than pepper lunch. server was being a little bitchy but i would be too if i was the only one working the front. 8/10
+omfg this is my favorite thing uve made 100/10
+and then we played bananagrams. sushi 8/10 thanks for paying mommy
+main street tino nothing special 7/10
+my peoples food. 9/10
+insane safeway hang 9/10
+this fuckass blue drink
+one of many.. 100/10
+this is the plaza where i used to go to all the time before school 9/10
+mac and cheese was gas. 10/10. you know its my fav comfort food. free the girl crying in the corner tho
+spartan tacos
+okay damn no way we got this b2b
+this is lowkey the spot poke always hits so fucking good
+hobags ughgmmfmfm im such a fucking ho for hobags 100/10
+carmel by the sea! we love sushi but tax 8/10
+sweet treat -> claire dropping the most insane piece of information ever -> hti the yap
+so good and soooo filling 10/10. also my peoples food.
+even when its rich white people breakfast im getting salmon nox 10/10
+1k cal meal 0 protein 10/10
+i dont want to talk about this. 9/10
+i can't believe u didnt eat ur leftovers. 10/10
+for my birthday!! i love eating meat and i love you so perfect combination 1000/10
+why was the store so nice. i wonder about the 4 sisters
+her boyfriend is so not real hes so stupid and funny. porridge was gas too i love eating free at julias 10/10
+spartan tacos. i was moody lol.
+i helped wrap the wontons w/ u !!! super fun and super yummy 10/10
+marry me? yes. 100/10 best valentines day ever
+poke house 3 years later 9/10 but +1 point bc its basically free
+mochi yinje black milk tea ts was actually so buss 10/10 only boba i've ever wanted to get again myself
+${escapeHtml(meal.description)}
`, + "\t\t\t\t", + ].join(eol); +} + +function renderGallery(meals, eol) { + return meals.map((meal) => renderGalleryItem(meal, eol)).join(eol); +} + +function replaceBlock(template, token, replacement) { + const pattern = new RegExp(`^[\\t ]*\\{\\{${token}\\}\\}$`, "m"); + + if (!pattern.test(template)) { + throw new Error(`Template is missing required block token "{{${token}}}"`); + } + + return template.replace(pattern, () => replacement); +} + +function buildIndex() { + const template = fs.readFileSync(indexTemplatePath, "utf8"); + const eol = detectEol(template); + const meals = JSON.parse(fs.readFileSync(mealsPath, "utf8")); + + validateMeals(meals); + + return replaceBlock(template, "gallery_items", renderGallery(meals, eol)); +} + +function writeFile(filePath, contents) { + fs.writeFileSync(filePath, contents); +} + +function main() { + writeFile(indexOutputPath, buildIndex()); +} + +main(); diff --git a/scripts/render-gallery.js b/scripts/render-gallery.js deleted file mode 100644 index 578f69c..0000000 --- a/scripts/render-gallery.js +++ /dev/null @@ -1,61 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const repoRoot = path.resolve(__dirname, ".."); -const dataPath = path.join(repoRoot, "data", "meals.json"); -const indexPath = path.join(repoRoot, "index.html"); - -const startMarker = ""; -const endMarker = ""; - -function escapeHtml(value) { - return value - .replace(/&/g, "&") - .replace(/", - `\t\t\t\t\t${escapeHtml(entry.description)}
`, - "\t\t\t\t", - ].join(eol); -} - -function renderGallery(entries, eol) { - return entries.map((entry) => renderArticle(entry, eol)).join(eol); -} - -function main() { - const entries = JSON.parse(fs.readFileSync(dataPath, "utf8")); - const indexHtml = fs.readFileSync(indexPath, "utf8"); - const eol = indexHtml.includes("\r\n") ? "\r\n" : "\n"; - const galleryMarkup = renderGallery(entries, eol); - const replacement = [ - `\t\t\t\t${startMarker}`, - galleryMarkup, - `\t\t\t\t${endMarker}`, - ].join(eol); - - const markerPattern = new RegExp( - `^[\\t ]*${startMarker}[\\s\\S]*?^[\\t ]*${endMarker}`, - "m" - ); - - if (!markerPattern.test(indexHtml)) { - throw new Error("Could not find gallery markers in index.html"); - } - - fs.writeFileSync(indexPath, indexHtml.replace(markerPattern, replacement)); -} - -main(); diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..c481725 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,56 @@ + + + + +
+ Please enable javascript >.<
+