diff --git a/gulpfile.js b/gulpfile.js index 49923c0f..d8792493 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ const paths = { }, images: { src: 'gulp/res/img/*', - dest: 'uploads/img/' + dest: 'static/img/' }, scripts: { src: 'gulp/res/js/*.js', diff --git a/helpers/writepagehtml.js b/helpers/writepagehtml.js new file mode 100644 index 00000000..0ca1bc46 --- /dev/null +++ b/helpers/writepagehtml.js @@ -0,0 +1,14 @@ +'use strict'; + +const util = require('util') + , fs = require('fs') + , pug = require('pug') + , path = require('path') + , writeFile = util.promisify(fs.writeFile) + , uploadDirectory = require(__dirname+'/uploadDirectory.js') + , pugDirectory = path.join(__dirname+'/../views/pages'); + +module.exports = async (htmlName, pugName, pugVars) => { + const html = pug.renderFile(`${pugDirectory}/${pugName}`, pugVars); + return writeFile(`${uploadDirectory}/htmlName`, html); +}; diff --git a/models/pages/home.js b/models/pages/home.js index cdddc7ba..f6f54c66 100644 --- a/models/pages/home.js +++ b/models/pages/home.js @@ -12,8 +12,6 @@ module.exports = async (req, res, next) => { return next(err); } - //render the page - res.render('home', { - boards: boards - }); + res.render('home', { boards }); + }