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'); }); });