Skip to content

Instantly share code, notes, and snippets.

View kartiknair's full-sized avatar

Kartik Nair kartiknair

View GitHub Profile
const fs = require("fs");
const postMethods = require("./posts");
const config = require("./config");
const posts = fs
.readdirSync(config.dev.postsdir)
.map(post => post.slice(0, -3))
.map(post => postMethods.createPost(post));
if (!fs.existsSync(config.dev.outdir)) fs.mkdirSync(config.dev.outdir);
const config = {
blogName: "Blog",
blogDescription: "Sharing what I learn as a web developer & designer",
authorName: "Kartik Nair",
authorDescription:
"a web developer and designer making lot's of stuff in Dubai",
authorTwitter: "https://twitter.com/kartiknair",
dev: {
postsdir: "./content",
const homepage = posts => `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="${config.blogDescription}" />
<title>${config.blogName}</title>
</head>
<body>
const addHomePage = posts => {
fs.writeFile(`${config.dev.outdir}/index.html`, homepage(posts), e => {
if (e) throw e;
console.log(`index.html was created successfully`);
});
};
const fs = require("fs");
const postMethods = require("./posts");
const config = require("./config");
const addHomePage = require("./homepage");
const posts = fs
.readdirSync(config.dev.postsdir)
.map(post => post.slice(0, -3))
.map(post => postMethods.createPost(post))
.sort(function(a, b) {
:root {
font-size: calc(0.75rem + 0.5vw);
}
.grotesk {
width: 60%;
margin: 5% 20% 0 20%;
}
@media (max-width: 500px) {
$bg: #1e3b5a;
$fg-body: #99b7c3;
$fg-headings: #c1d6df;
$hr-color: rgba(153, 183, 195, 0.2);
$a-color: #d8e9f0;
$pre-bg: rgba(153, 183, 195, 0.07);
$pre-color: $fg-body;
@font-face {
font-family: lyon;
src: url("../fonts/LyonDisplay-Bold.otf");
font-weight: 800;
}
@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:wght@500&display=swap");
$font-fam-main: "EB Garamond", serif;
$font-fam-headings: lyon, serif;
html,
body {
font-size: 1rem;
}
h1 {
font-size: 2.25rem;
}
h2 {
/* ↓ This one is for smaller phones ↓ */
@media (max-width: 350px) {
html {
font-size: 0.9rem;
}
}
/* ↓ These are for high-res displays ↓ */
@media (min-width: 1900px) {
html {