Added file inclusion macro. It's ALIVE!
parent
e7614d828e
commit
93d4bb41d1
56
build.js
56
build.js
|
@ -1,7 +1,55 @@
|
|||
const fs = require('fs');
|
||||
// const path = require('path');
|
||||
const readline = require('readline')
|
||||
|
||||
//todo: read through files and fill in components before copying
|
||||
fs.cp('./src/','./build', { recursive: true }, (err) => {
|
||||
if (err) throw err;
|
||||
console.log('Build was successful!');
|
||||
const files = ["src/index.html",
|
||||
"src/projects/2016-XXXX.html"];
|
||||
|
||||
files.forEach( file => {
|
||||
// console.log(file + "...");
|
||||
// console.log(file.split('/').slice(1).join('/') + "\n"); //remove /src
|
||||
|
||||
var file_buffer = "";
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: fs.createReadStream(file),
|
||||
output: process.stdout,
|
||||
terminal: false
|
||||
});
|
||||
|
||||
const re = new RegExp('{% include \'*(.*)\' %}');
|
||||
|
||||
rl.on('line', line => {
|
||||
const match = line.match(re);
|
||||
if (match) {
|
||||
file_buffer += fs.readFileSync(match[1], 'utf8');
|
||||
} else {
|
||||
file_buffer += line + "\n";
|
||||
}
|
||||
});
|
||||
|
||||
rl.on('close', () => {
|
||||
//fs.mkdirSync('build/' + file.split('/').slice(1,-1).join('/')); // create dirs
|
||||
ensureDirectoryExists('build/' + file.split('/').slice(1).join('/'));
|
||||
fs.writeFileSync('build/' + file.split('/').slice(1).join('/'), file_buffer, 'utf8');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// fs.cp('./src/projects','./build/projects', { recursive: true }, (err) => {
|
||||
// if (err) throw err;
|
||||
// });
|
||||
|
||||
fs.cp('./src/styles','./build/styles', { recursive: true }, (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
|
||||
function ensureDirectoryExists(filePath) {
|
||||
var dirname = filePath.split('/').slice(0,-1).join('/');
|
||||
if (fs.existsSync(dirname)) {
|
||||
return true;
|
||||
}
|
||||
ensureDirectoryExists(dirname);
|
||||
fs.mkdirSync(dirname);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<div class="footer">
|
||||
<p>©2021 Jordan Hanrahan</p>
|
||||
</div>
|
||||
<footer>
|
||||
<p>©2023 Jordan Hanrahan</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/styles.css" />
|
||||
<title>Jordan Hanrahan - Portfolio</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/styles/normalize.css" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<title>Jordan Hanrahan - Portfolio</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,28 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/styles/normalize.css" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<title>Jordan Hanrahan - Portfolio</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="masthead">
|
||||
<a href="/">
|
||||
<div class="logo">
|
||||
<h1>Jordan Hanrahan</h1>
|
||||
<h2>Art Direction · Graphic Design · Motion Graphics</h2>
|
||||
</div>
|
||||
</a>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/about.html">about</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
{% include 'src/components/head.html' %}
|
||||
{% include 'src/components/header.html' %}
|
||||
<!-- the build script should generate links from items in project folder here. -->
|
||||
<main>
|
||||
<div class="projects">
|
||||
|
@ -32,7 +9,4 @@
|
|||
</ul>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<p>©2023 Jordan Hanrahan</p>
|
||||
</footer>
|
||||
</html>
|
||||
{% include 'src/components/footer.html' %}
|
||||
|
|
|
@ -1,44 +1,11 @@
|
|||
<!--
|
||||
---
|
||||
date: 2021-02-01
|
||||
thumbnail: "/uploads/cbc_xxxxportfoliocover_210202_v01.png"
|
||||
title: XX XX
|
||||
categories:
|
||||
- Graphic Design
|
||||
- Art Direction
|
||||
project_bg_color: ''
|
||||
project_fg_color: ''
|
||||
published: true
|
||||
showcase: true
|
||||
project_year: 2020
|
||||
|
||||
---
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/styles/normalize.css" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<title>Jordan Hanrahan - Portfolio</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="masthead">
|
||||
<a href="/">
|
||||
<div class="logo">
|
||||
<h1>Jordan Hanrahan</h1>
|
||||
<h2>Art Direction · Graphic Design · Motion Graphics</h2>
|
||||
</div>
|
||||
</a>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/about.html">about</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
{% include 'src/components/head.html' %}
|
||||
{% include 'src/components/header.html' %}
|
||||
<main>
|
||||
<h1>XX XX</h1>
|
||||
<h2>Until it's recent closure, **XX XX** was one of South-East Asia's premiere venues for dance music, bringing local DJs and producers to the fore, while hosting international acts such as **Kevin Saunderson** <small>(KMS, Detroit)</small>, **FJAAK** <small>(50Weapons, Berlin)</small>, **Answer Code Request** <small>(Berghain/Ostgut Ton, Berlin)</small>, Jamie XX, **Chris Cruse** <small>(Spotlight, LA)</small>, **ND_Baumecker** <small>(Ostgut Ton, Berlin)</small>, **Sofie** <small>(Stones Throw/Boiler Room, LA)</small>, **Milton Bradley** <small>(Do Not Resist The Beat/Alien Rain, Berlin)</small> and many more.</h2>
|
||||
|
@ -129,9 +96,5 @@
|
|||
<img src="/uploads/cbc_xxxx/cbc_venuephotos_xxxx_181213_08.jpg" />
|
||||
<img src="/uploads/cbc_xxxx/cbc_venuephotos_xxxx_181213_07.jpg" />
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<p>©2023 Jordan Hanrahan</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
</main>
|
||||
{% include 'src/components/footer.html' %}
|
||||
|
|
Loading…
Reference in New Issue