Skip to content

Commit

Permalink
Make it bettah.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Mar 14, 2017
1 parent ed5a3f2 commit 06e6110
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
37 changes: 30 additions & 7 deletions bin/makesite
Expand Up @@ -6,18 +6,41 @@ use 5.010;

use Template;
use FindBin '$Bin';
use File::Basename;
use File::Find;
use File::Path 'make_path';
use File::Copy;

my $tt = Template->new(
INCLUDE_PATH => ["$Bin/../tt_lib", "$Bin/../in" ],
INCLUDE_PATH => ["$Bin/../tt_lib", "$Bin/.." ],
OUTPUT_PATH => "$Bin/../docs",
WRAPPER => 'page',
);

foreach (glob "in/*.tt") {
s|^in/||;
my $out = s/\.tt$//r;
find({ wanted => \&do_this, no_chdir => 1 }, 'in');

$tt->process($_, {}, $out)
or die $tt->error;
sub do_this {
debug("File is: $_\n");
return unless -f;
debug("File::Find::dir: $File::Find::dir\n");
my $dest = $File::Find::dir =~ s|^in/?||r;
debug("Dest: $dest\n");

debug("docs/$dest");
make_path "docs/$dest";

if (/\.tt$/) {
my $out = s|\.tt$||r;
$out =~ s|^in/||;

debug("tt: $_ -> $out\n");
$tt->process($_, {}, $out)
or die $tt->error;
} else {
debug("Copy: $_ -> docs/$dest\n");
copy $_, "docs/$dest";
}
}

sub debug {
warn @_ if $ENV{TT_DEBUG};
}
1 change: 1 addition & 0 deletions in/CNAME
@@ -0,0 +1 @@
web.perlhacks.com
5 changes: 5 additions & 0 deletions in/css/styles.css
@@ -0,0 +1,5 @@
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
padding-bottom: 20px;
}

0 comments on commit 06e6110

Please sign in to comment.