diff options
author | June McEnroe <june@causal.agency> | 2020-07-10 09:38:46 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-10 09:38:46 -0400 |
commit | bc8b57c001c05f20579b0fdd6c75e26ee6255ffc (patch) | |
tree | 7eba86206c297425e55d8fdf5b7299600b6a9a76 /html.c | |
parent | Add default stylesheet (diff) | |
download | scooper-bc8b57c001c05f20579b0fdd6c75e26ee6255ffc.tar.gz scooper-bc8b57c001c05f20579b0fdd6c75e26ee6255ffc.zip |
Serve stylesheet separately, with caching
Diffstat (limited to '')
-rw-r--r-- | html.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/html.c b/html.c index c6b4a42..dbc6631 100644 --- a/html.c +++ b/html.c @@ -21,27 +21,7 @@ #include "server.h" -static const char DefaultStyle[] = { -#include "default.css.h" - ,'\0' -}; - -const char *htmlStylesheet; - -static enum kcgi_err stylesheet(struct khtmlreq *html) { - if (htmlStylesheet) { - return khtml_attr( - html, KELEM_LINK, - KATTR_REL, "stylesheet", - KATTR_HREF, htmlStylesheet, - KATTR__MAX - ); - } - return 0 - || khtml_elem(html, KELEM_STYLE) - || khtml_puts(html, DefaultStyle) - || khtml_closeelem(html, 1); -} +const char *htmlStylesheet = "stylesheet.css"; enum kcgi_err htmlHead(struct khtmlreq *html, const char *title) { return khtml_elem(html, KELEM_DOCTYPE) @@ -49,7 +29,12 @@ enum kcgi_err htmlHead(struct khtmlreq *html, const char *title) { || khtml_elem(html, KELEM_TITLE) || khtml_puts(html, title) || khtml_closeelem(html, 1) - || stylesheet(html) + || khtml_attr( + html, KELEM_LINK, + KATTR_REL, "stylesheet", + KATTR_HREF, htmlStylesheet, + KATTR__MAX + ) || khtml_elem(html, KELEM_H1) || khtml_puts(html, title) || khtml_closeelem(html, 1); |