1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00

bugfixes: added await for fileWrites (was hanging), added path import, url escape issue (#58)

* added await for fileWrites (was hanging), added path import

* fixed html escaping issue with background image. +consistency

* changed default background to smaller params. only 90kb
This commit is contained in:
Benjamin Liden 2019-05-26 06:03:13 -04:00 committed by imfunny
parent de728e75bd
commit 17cd85327b
4 changed files with 9 additions and 16 deletions

View file

@ -2,9 +2,9 @@
--bg-color: rgb(10, 10, 10);
--text-color: #fff;
--blog-gray-color: rgb(180, 180, 180);
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.6), rgb(10, 10, 10, 1)), url("{{background}}");
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.6), rgb(10, 10, 10, 1)), url("{{{background}}}");
--background-background: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0.6)),
url("{{background}}") center center fixed;
url("{{{background}}}") center center fixed;
--height: 50vh;
}
#display h1 {
@ -26,6 +26,6 @@
@media (max-width: 800px) {
:root {
--background-image: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0)),
url("{{background}}") !important;
url("{{{background}}}") !important;
}
}

View file

@ -2,6 +2,6 @@
--bg-color: #fff;
--text-color: rgb(10, 10, 10);
--blog-gray-color: rgb(80, 80, 80);
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.4), rgb(10, 10, 10, 0.4)), url("{{background}}");
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.4), rgb(10, 10, 10, 0.4)), url("{{{background}}}");
--background-background: #fff;
}

View file

@ -20,7 +20,7 @@ const config = path.join(outDir, 'config.json');
*/
async function populateCSS({
theme = 'light',
background = 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1450',
background = 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=500&h=1000&q=80&fit=crop',
} = {}) {
/* Get the theme the user requests. Defaults to 'light' */
theme = `${theme}.css`;
@ -73,16 +73,9 @@ async function populateConfig(sort, order, includeFork) {
async function buildCommand(username, program) {
await populateCSS(program);
let sort = program.sort ? program.sort : 'created';
let order = "asc";
let includeFork = false;
if(program.order){
order = ('%s', program.order);
}
if(program.fork){
includeFork = true;
}
let order = program.order ? program.order : "asc";
let includeFork = program.fork ? true : false;
await populateConfig(sort, order, includeFork);
updateHTML(('%s', username), sort, order, includeFork);
}

View file

@ -121,11 +121,11 @@ module.exports.updateHTML = (username, sort, order, includeFork) => {
data[0].username = user.login;
data[0].name = user.name;
data[0].userimg = user.avatar_url;
fs.writeFile(`${outDir}/config.json`, JSON.stringify(data, null, ' '), function (err) {
await fs.writeFile(`${outDir}/config.json`, JSON.stringify(data, null, ' '), function (err) {
if (err) throw err;
console.log("Config file updated.");
});
fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) {
await fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) {
if (error) throw error;
console.log(`Build Complete, Files can be Found @ ${outDir}`);
});