<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

package IkiWiki::Plugin::localstyle;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
	hook(type =&gt; "getsetup", id =&gt; "localstyle", call =&gt; \&amp;getsetup);
	hook(type =&gt; "pagetemplate", id =&gt; "localstyle", call =&gt; \&amp;pagetemplate);
}

sub getsetup () {
	return
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; 1,
		},
}

sub pagetemplate (@) {
	my %params=@_;
	
	my $template=$params{template};
	
	if ($template-&gt;query(name =&gt; "local_css")) {
		my $best=bestlink($params{page}, 'local.css');
		if ($best) {
			$template-&gt;param(local_css =&gt; $best);
		}
	}
}

1
</pre></body></html>