From b06bc33b21d1015aadb02e42379a5c570d188ac5 Mon Sep 17 00:00:00 2001 From: Jahnertz Date: Thu, 25 May 2023 20:40:32 +1000 Subject: [PATCH] added constants for build/src paths --- build.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index 21db015..f7c7db5 100644 --- a/build.js +++ b/build.js @@ -1,5 +1,7 @@ const fs = require('fs'); -const readline = require('readline') +const readline = require('readline'); +//const src_dir = 'src'; +const build_dir = 'build'; const files = ["src/index.html", "src/about.html", @@ -26,8 +28,8 @@ files.forEach( file => { } 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) => { + 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, ""); @@ -36,8 +38,8 @@ files.forEach( file => { }); 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_dir + '/' + 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'); }); });