Compare commits
No commits in common. "b06bc33b21d1015aadb02e42379a5c570d188ac5" and "19af589c1ccadef9e34bc3761a5437fec3cab688" have entirely different histories.
b06bc33b21
...
19af589c1c
31
build.js
31
build.js
|
@ -1,10 +1,8 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const readline = require('readline');
|
// const path = require('path');
|
||||||
//const src_dir = 'src';
|
const readline = require('readline')
|
||||||
const build_dir = 'build';
|
|
||||||
|
|
||||||
const files = ["src/index.html",
|
const files = ["src/index.html",
|
||||||
"src/about.html",
|
|
||||||
"src/projects/2016-XXXX.html",
|
"src/projects/2016-XXXX.html",
|
||||||
"src/projects/2023-Pepperstone.html"]; // this list should be generated.
|
"src/projects/2023-Pepperstone.html"]; // this list should be generated.
|
||||||
|
|
||||||
|
@ -17,29 +15,20 @@ files.forEach( file => {
|
||||||
terminal: false
|
terminal: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const re_include = new RegExp('{% include \'*(.*)\' %}');
|
const re = new RegExp('{% include \'*(.*)\' %}');
|
||||||
const re_picture = new RegExp('{% picture \'*(.*)\' %}');
|
|
||||||
|
|
||||||
rl.on('line', line => {
|
rl.on('line', line => {
|
||||||
const match_include = line.match(re_include);
|
const match = line.match(re);
|
||||||
const match_picture = line.match(re_picture);
|
if (match) {
|
||||||
if (match_include) {
|
file_buffer += fs.readFileSync(match[1], 'utf8');
|
||||||
line = line.replace(re_include, fs.readFileSync(match_include[1], 'utf8'));
|
} else {
|
||||||
|
file_buffer += line + "\n";
|
||||||
}
|
}
|
||||||
if (match_picture) {
|
|
||||||
const picture_src = match_picture[1].split('/').slice(1).join('/');
|
|
||||||
ensureDirectoryExists(build_dir + '/' + picture_src);
|
|
||||||
fs.cp(match_picture[1], build_dir + '/' + picture_src, { recursive: false }, (err) => {
|
|
||||||
if (err) throw err;
|
|
||||||
});
|
|
||||||
line = line.replace(re_picture, "<img src=\'/" + picture_src + "\' \>");
|
|
||||||
}
|
|
||||||
file_buffer += line;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
rl.on('close', () => {
|
rl.on('close', () => {
|
||||||
ensureDirectoryExists(build_dir + '/' + file.split('/').slice(1).join('/')); // all this quatch is to remove the /src/.
|
ensureDirectoryExists('build/' + file.split('/').slice(1).join('/')); // all this quatch is to remove the /src/.
|
||||||
fs.writeFileSync(build_dir + '/' + file.split('/').slice(1).join('/'), file_buffer, 'utf8');
|
fs.writeFileSync('build/' + file.split('/').slice(1).join('/'), file_buffer, 'utf8');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
{% include 'src/components/head.html' %}
|
|
||||||
{% include 'src/components/header.html' %}
|
|
||||||
<main>
|
|
||||||
<div>
|
|
||||||
{% picture 'src/images/JHN_Head_200131_v03.png' %}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h2>I’m Jordan Hanrahan — a Melbourne based art director and multi−disciplinary designer.</h2>
|
|
||||||
<p>My specialties lie between the fields of communication, digital and motion design, all of which I am deeply passionate about.</p>
|
|
||||||
<p>I graduated from Swinburne University of Technology, BA. Design, Multimedia Design in 2014, and have since worked in agencies and as a freelancer all across the Asia Pacific region.</p>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% include 'src/components/footer.html' %}
|
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue