fol/builder

Static site generator

Installs: 50

Dependents: 1

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

v2.1.0 2015-12-31 10:21 UTC

README

Scrutinizer Code Quality

This is a simple library to build static sites.

Example

require "vendor/autoload.php";

//Create an app
class Site extends Fol\Builder\App
{
    public function __construct()
    {
        //Serve files from /sources/img/*
        $this->addServer('files', 'files/*');

        //Transform and serve images from /sources/img/* to /build/img/*
        $this->addServer('images', 'img/*', 'img/*')->transform('resize,50');

        //Render and serve php files from /sources/pages/*.php to /build/*.html
        $this->addServer('php', 'pages/*.php');

        //Render and serve pages from /sources/data/*.yml to /build/*.html using templates
        $this->addServer('pages', 'data/*.yml')->templates('templates');

        //Build the sitemap with all *.html files
        $this->addBuilder('sitemap');

        //Validate all htmls on build
        $this->addBuilder('htmlValidator');
    }
}

//Serve the files on demand (using the php server)
Site::run();

//Or generate and save the entire site
(new Site())->build();