Skip to content

nunorc/p6-Pekyll

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
t
 
 
 
 
 
 
 
 
 
 
 
 

Pekyll

A very simple tool to generate static websites from sources in different formats, inspired by Hakyll, written in Perl 6.

Under heavy development, things will change.. you have been warned!

Synopsis

The basic idea is to define a router and a compiler for sets of files. The router is used to define how the final destination of the file is built from the original file path. And the compiler is used to build the final HTML from the source file. There are some previously defined routers and compilers available.

use Pekyll;
use Pekyll::Routers;
use Pekyll::Compilers;

my %rules = (
    'assets/*' => { router=>&router_id, compiler=>&plain_copy },
    'static/*' => { router=>&ext2html,  compiler=>&compile_static },
    '_end'     => &wrap_up,
  );

my $pekyll = Pekyll.new(:%rules);
$pekyll.build('src', 'dist');

sub compile_static($src, $target) { ...  }
sub wrap_up($dst) { ... }

In a nutshell this reads for every file in source directory assets use the router_id function to build the final path for the file (the same in this case), and the plain_copy function to build the final file.

The special _end rule is executed once (in the end), useful for generating feeds, or special page.

Example

For a more complex example visit this repository.

About

perl6 static website generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%