commit 197b62fd34881f5d5b7432a60c01b2ea454181ad
parent 874cae4594e4650a60a3b47deb2dd2da8c74d6fb
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Wed, 8 Mar 2023 18:37:36 -0500
Add default CSS to style.css
Generate style.css with ~100 bytes of useful CSS that makes a site
presentable by default.
Diffstat:
M | sbs | | | 15 | ++++++++++++--- |
M | sbs.1 | | | 5 | +++-- |
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/sbs b/sbs
@@ -49,8 +49,7 @@ new()
printf "Created: %s\n" "$3"
elif [ "$2" = "site" ]; then
mkdir "$3" "$3/content/" "$3/static/" "$3/templates/"
- touch "$3/static/style.css"
- # Create template config.ini file
+ # Create config.ini
{ printf "siteURL = https://example.com/\n"
printf "siteName = %s\n" "$3"
printf "blogDir = blog/\n"
@@ -79,7 +78,17 @@ new()
printf '</body>\n'
printf '</html>\n'
} > "$3/templates/footer.html"
- > "$3/static/style.css"
+ # Create style.css
+ { printf "html {\n"
+ printf "\tmax-width: 38em;\n"
+ printf "\tpadding: 1em;\n"
+ printf "\tmargin: auto;\n"
+ printf "\tline-height: 1.4em;\n"
+ printf "}\n\n"
+ printf "img {\n"
+ printf "\tmax-width: 100%%;\n"
+ printf "}\n"
+ } > "$3/static/style.css"
printf "Created: %s\n" "$3"
else
printf "Subcommand '%s' not recognized. See sbs(1) for documentation.\n" "$2"
diff --git a/sbs.1 b/sbs.1
@@ -149,8 +149,9 @@ The directory containing all static assets (images, videos, robots.txt, etc.),
including the HTML files built by
.Nm .
.It Pa static/style.css
-The main CSS file for the website. It is an empty file by default. A stylesheet
-link tag pointing to this is already in the templates/header.html file.
+The main CSS file for the website. It is generated with a small amount of CSS
+that makes the site look presentable. A link tag pointing to this file is in
+.Pa templates/header.html .
.It Pa templates/
The directory that contains the following template files:
.It Pa templates/header.html