From 062ed44f47d61c3bbbf2e8a7944a9b4e423b735a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 16 Jun 2010 15:43:42 -0400 Subject: add theme plugin --- IkiWiki/Plugin/theme.pm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 IkiWiki/Plugin/theme.pm (limited to 'IkiWiki/Plugin/theme.pm') diff --git a/IkiWiki/Plugin/theme.pm b/IkiWiki/Plugin/theme.pm new file mode 100644 index 000000000..5e6e4b092 --- /dev/null +++ b/IkiWiki/Plugin/theme.pm @@ -0,0 +1,37 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::theme; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "theme", call => \&getsetup); + hook(type => "checkconfig", id => "theme", call => \&checkconfig); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 0, + section => "web", + }, + theme => { + type => "string", + example => "actiontabs", + description => "name of theme to enable", + safe => 1, + rebuild => 0, + }, +} + +my $added=0; +sub checkconfig () { + if (! $added && exists $config{theme} && $config{theme} =~ /^\w+$/) { + add_underlay("themes/".$config{theme}); + $added=1; + } +} + +1 -- cgit v1.2.3 From 2f3f826b5bf123886d4e65eb8bd709b12639ca8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 16 Jun 2010 15:44:21 -0400 Subject: force rebuild for theme change For now, a rebuild is the only way to ensure the changed theme is used. Ikiwiki normally will not realize style.css has changed, since themes tend to have the same timestamp for the file. --- IkiWiki/Plugin/theme.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/theme.pm') diff --git a/IkiWiki/Plugin/theme.pm b/IkiWiki/Plugin/theme.pm index 5e6e4b092..ba6966381 100644 --- a/IkiWiki/Plugin/theme.pm +++ b/IkiWiki/Plugin/theme.pm @@ -22,7 +22,7 @@ sub getsetup () { example => "actiontabs", description => "name of theme to enable", safe => 1, - rebuild => 0, + rebuild => 1, }, } -- cgit v1.2.3