-all: sitemap.xml light.css plan.plp UPDATE data cache
+all: sitemap.xml style plan.plp UPDATE data cache
.PHONY: force # applied to download after 2 hours
download := $(shell [ -z $$(find data/download -mmin -120) ] && (touch data/download && echo force))
# atomically create file by command
-cmdsave = @echo '$1' $2 \>$@; mispipe '$1 $2' 'ifne sponge $@'
+cmdsave = @echo "$1" $2 \>$@; mispipe "$1 $2" 'ifne sponge $@'
# download git checkout
gitsave = @if cd $@ 2>/dev/null; \
then echo git pull $@; git pull -q --ff-only || true; \
sitemap.xml: tools/mksitemap
$(call cmdsave,$<)
-light.css: tools/stripcss base.css
- $(call cmdsave,$^)
+style: light.css sc.css
+%.css: style/%.scss $(wildcard style/_*.scss)
+ $(call cmdsave,sassc -t compressed $< | perl -pE 's/\}+\K/\n/g')
plan.plp: TODO
kramdown $< >$@
UPDATE: $(download)
- $(call cmdsave,git log -1 --date=short --pretty="%ad %s")
+ $(call cmdsave,git log -1 --date=short --pretty='%ad %s')
cache: $(patsubst %.inc.pl,data/%.json,$(wildcard charset-*.inc.pl) $(wildcard keyboard/altgr/*.inc.pl) writing-latn.inc.pl)
word: word/put.min.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json
} or warn "Unable to create style cookie: $@";
}
- $style ||= exists $cookie{style} && $styles{ $cookie{style} } || $avail[0];
-
- return map { sprintf(
- '<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
- $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.19", $_
- ) } @avail;
+ $style ||= $styles{$_} for $cookie{style} || ();
+ my $setstyle = $style;
+ $style ||= $avail[0];
+ return $setstyle;
}
sub checkmodified {
$header{content_type} = "text/html; charset=$meta->{charset}"
unless $PLP::sentheaders;
exit if $ENV{REQUEST_METHOD} eq 'HEAD';
- unshift @{ $meta->{raw} }, stylesheet($meta->{stylesheet});
- push @{ $meta->{raw} }, (
- '<link rel="stylesheet" type="text/css" media="monochrome" href="/mono.css?1.11" title="light">',
+ unshift @{ $meta->{raw} }, (
+ '<link rel="stylesheet" type="text/css" media="all" href="/light.css?1.20">',
);
+ $meta->{stylesheet} = stylesheet($meta->{stylesheet});
if (my $img = $meta->{image}) {
my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's');
PLP_START {
# leading output
say '<!DOCTYPE html>';
- say qq(<html lang="$meta->{lang}">);
+ my $rootattr = '';
+ $rootattr .= qq( class="s-$_") for $meta->{stylesheet} || ();
+ say qq(<html lang="$meta->{lang}"$rootattr>);
say '';
say '<head>';
say sprintf '<meta http-equiv="content-type" content="%s">', $_
say '<link rel="icon" type="image/png" href="/clip.png">';
say for map { @{$_} } $meta->{raw} || ();
say '<meta name="robots" content="noindex">' if $Dev;
+ say "<script>$_</script>" for join($/,
+ "if (m = window.matchMedia('(monochrome)'))",
+ "(m.onchange = e => document.documentElement.classList.toggle('s-mono', e.matches))(m);",
+ );
say '</head>';
say '';
say sprintf '<body id="%s">', $file;