diff --git a/build.js b/build.js index 099299f..21db015 100644 --- a/build.js +++ b/build.js @@ -1,34 +1,43 @@ const fs = require('fs'); -// const path = require('path'); const readline = require('readline') const files = ["src/index.html", - "src/projects/2016-XXXX.html", - "src/projects/2023-Pepperstone.html"]; // this list should be generated. + "src/about.html", + "src/projects/2016-XXXX.html", + "src/projects/2023-Pepperstone.html"]; // this list should be generated. files.forEach( file => { var file_buffer = ""; const rl = readline.createInterface({ - input: fs.createReadStream(file), - output: process.stdout, - terminal: false + input: fs.createReadStream(file), + output: process.stdout, + terminal: false }); - const re = new RegExp('{% include \'*(.*)\' %}'); + const re_include = new RegExp('{% include \'*(.*)\' %}'); + const re_picture = new RegExp('{% picture \'*(.*)\' %}'); rl.on('line', line => { - const match = line.match(re); - if (match) { - file_buffer += fs.readFileSync(match[1], 'utf8'); - } else { - file_buffer += line + "\n"; - } + const match_include = line.match(re_include); + const match_picture = line.match(re_picture); + if (match_include) { + line = line.replace(re_include, fs.readFileSync(match_include[1], 'utf8')); + } + if (match_picture) { + const picture_src = match_picture[1].split('/').slice(1).join('/'); + ensureDirectoryExists('build/' + picture_src); + fs.cp(match_picture[1], 'build/' + picture_src, { recursive: false }, (err) => { + if (err) throw err; + }); + line = line.replace(re_picture, ""); + } + file_buffer += line; }); rl.on('close', () => { - ensureDirectoryExists('build/' + file.split('/').slice(1).join('/')); // all this quatch is to remove the /src/. - fs.writeFileSync('build/' + file.split('/').slice(1).join('/'), file_buffer, 'utf8'); + ensureDirectoryExists('build/' + file.split('/').slice(1).join('/')); // all this quatch is to remove the /src/. + fs.writeFileSync('build/' + file.split('/').slice(1).join('/'), file_buffer, 'utf8'); }); }); @@ -40,7 +49,7 @@ fs.cp('./src/styles','./build/styles', { recursive: true }, (err) => { function ensureDirectoryExists(filePath) { var dirname = filePath.split('/').slice(0,-1).join('/'); if (fs.existsSync(dirname)) { - return true; + return true; } ensureDirectoryExists(dirname); fs.mkdirSync(dirname); diff --git a/src/about.html b/src/about.html new file mode 100644 index 0000000..4f0f825 --- /dev/null +++ b/src/about.html @@ -0,0 +1,13 @@ +{% include 'src/components/head.html' %} +{% include 'src/components/header.html' %} +
+
+ {% picture 'src/images/JHN_Head_200131_v03.png' %} +
+
+

I’m Jordan Hanrahan — a Melbourne based art director and multi−disciplinary designer.

+

My specialties lie between the fields of communication, digital and motion design, all of which I am deeply passionate about.

+

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.

+
+
+{% include 'src/components/footer.html' %} diff --git a/src/images/JHN_Head_200131_v03.png b/src/images/JHN_Head_200131_v03.png new file mode 100644 index 0000000..f328e65 Binary files /dev/null and b/src/images/JHN_Head_200131_v03.png differ