summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/localstyle.pm
blob: 111f4dc30b44cd41404995da4fd23164decaab67 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::localstyle;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 3.00;
  6. sub import {
  7. hook(type => "getsetup", id => "localstyle", call => \&getsetup);
  8. hook(type => "pagetemplate", id => "localstyle", call => \&pagetemplate);
  9. }
  10. sub getsetup () {
  11. return
  12. plugin => {
  13. safe => 1,
  14. rebuild => 1,
  15. },
  16. }
  17. sub pagetemplate (@) {
  18. my %params=@_;
  19. my $template=$params{template};
  20. if ($template->query(name => "local_css")) {
  21. my $best=bestlink($params{page}, 'local.css');
  22. if ($best) {
  23. $template->param(local_css => $best);
  24. }
  25. }
  26. }
  27. 1