refactor: some docs, refactor basic template a lil bit

This commit is contained in:
dusk 2021-05-16 03:05:10 +03:00
parent 5dab512a5d
commit 6d61daa842
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
3 changed files with 20 additions and 7 deletions

View File

@ -6,7 +6,10 @@ in
htmlNix.mkServeFromSite (htmlNix.mkSiteFrom {
inherit src;
templater = context: pkgs.lib.pipe context [
# Add basic template
lib.templaters.basic
# Add about page
({ site, mkPage, ... }@result: {
site = site // {
"about.html" = with lib.tags; mkPage [

View File

@ -10,10 +10,14 @@
utils = import ./utils.nix;
lib = {
# Convert Nix expressions to HTML
tags = import ./tags.nix { inherit utils; };
# Convert Nix expressions to CSS
css = import ./css.nix { inherit utils; };
# Various site templaters
templaters = {
# Basic templater with purecss, mobile responsive layout and supports posts
basic = import ./templaters/basic.nix;
};
};

View File

@ -3,7 +3,11 @@ let
inherit (utils) readFile mapAttrsToList tags fetchGit map;
inherit (pkgs.lib) flatten optional length;
stylesheets = map tags.mkStylesheet [ "https://unpkg.com/purecss@2.0.6/build/pure-min.css" "https://unpkg.com/purecss@2.0.6/build/grids-responsive-min.css" "mine.css" ];
stylesheets = map tags.mkStylesheet [
"https://unpkg.com/purecss@2.0.6/build/pure-min.css"
"https://unpkg.com/purecss@2.0.6/build/grids-responsive-min.css"
"mine.css"
];
renderPost = name: value: with tags; article [
(a { href = "#${name}"; class = "postheader"; } (h3 { id = name; } ("## " + name)))
@ -37,6 +41,12 @@ let
stylesheet =
with utils.css;
let
marginMobile = {
margin-left = "3%";
margin-right = "3%";
};
in
css [
(css {
body = {
@ -71,14 +81,10 @@ let
"nav.sidebar" = {
position = "relative";
margin-top = "5%";
margin-left = "3%";
margin-right = "3%";
};
} // marginMobile;
"div.content" = {
margin-top = 0;
margin-left = "3%";
margin-right = "3%";
};
} // marginMobile;
})
];
in