Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

Commit 17cd853

Browse files
bclidenimfunniee
authored andcommitted
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
1 parent de728e7 commit 17cd853

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

assets/themes/dark.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
--bg-color: rgb(10, 10, 10);
33
--text-color: #fff;
44
--blog-gray-color: rgb(180, 180, 180);
5-
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.6), rgb(10, 10, 10, 1)), url("{{background}}");
5+
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.6), rgb(10, 10, 10, 1)), url("{{{background}}}");
66
--background-background: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0.6)),
7-
url("{{background}}") center center fixed;
7+
url("{{{background}}}") center center fixed;
88
--height: 50vh;
99
}
1010
#display h1 {
@@ -26,6 +26,6 @@
2626
@media (max-width: 800px) {
2727
:root {
2828
--background-image: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0)),
29-
url("{{background}}") !important;
29+
url("{{{background}}}") !important;
3030
}
3131
}

assets/themes/light.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
--bg-color: #fff;
33
--text-color: rgb(10, 10, 10);
44
--blog-gray-color: rgb(80, 80, 80);
5-
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.4), rgb(10, 10, 10, 0.4)), url("{{background}}");
5+
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.4), rgb(10, 10, 10, 0.4)), url("{{{background}}}");
66
--background-background: #fff;
77
}

build.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const config = path.join(outDir, 'config.json');
2020
*/
2121
async function populateCSS({
2222
theme = 'light',
23-
background = 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1450',
23+
background = 'https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=500&h=1000&q=80&fit=crop',
2424
} = {}) {
2525
/* Get the theme the user requests. Defaults to 'light' */
2626
theme = `${theme}.css`;
@@ -73,16 +73,9 @@ async function populateConfig(sort, order, includeFork) {
7373

7474
async function buildCommand(username, program) {
7575
await populateCSS(program);
76-
7776
let sort = program.sort ? program.sort : 'created';
78-
let order = "asc";
79-
let includeFork = false;
80-
if(program.order){
81-
order = ('%s', program.order);
82-
}
83-
if(program.fork){
84-
includeFork = true;
85-
}
77+
let order = program.order ? program.order : "asc";
78+
let includeFork = program.fork ? true : false;
8679
await populateConfig(sort, order, includeFork);
8780
updateHTML(('%s', username), sort, order, includeFork);
8881
}

populate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ module.exports.updateHTML = (username, sort, order, includeFork) => {
121121
data[0].username = user.login;
122122
data[0].name = user.name;
123123
data[0].userimg = user.avatar_url;
124-
fs.writeFile(`${outDir}/config.json`, JSON.stringify(data, null, ' '), function (err) {
124+
await fs.writeFile(`${outDir}/config.json`, JSON.stringify(data, null, ' '), function (err) {
125125
if (err) throw err;
126126
console.log("Config file updated.");
127127
});
128-
fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) {
128+
await fs.writeFile(`${outDir}/index.html`, '<!DOCTYPE html>' + window.document.documentElement.outerHTML, function (error) {
129129
if (error) throw error;
130130
console.log(`Build Complete, Files can be Found @ ${outDir}`);
131131
});

0 commit comments

Comments
 (0)