spress/spress-core

Static site generator with blogs support

v2.2.0 2017-04-13 10:20 UTC

README

Build Status Scrutinizer Code Quality SensioLabsInsight

Spress is a static site generator built with Symfony components and Twig as default template engine. This repository is the core of Spress application.

Installation

Go to your app folder and input the following command:

composer require spress/spress-core

How to use?

The entry-point class is Yosymfony\Spress\Core\Spress. The below example point out how to use:

use Yosymfony\Spress\Core\Spress;

class MyClass
{
    public function parseSite()
    {
        $spress = new Spress();
        $spress['spress.config.site_dir'] = '/path-to-your-spress-site';
        $spress->parse();
    }
}

Including draft posts

use Yosymfony\Spress\Core\Spress;

class MyClass
{
    public function parseSite()
    {
        $spress = new Spress();
        $spress['spress.config.site_dir'] = '/path-to-your-spress-site';
        $spress['spress.config.drafts'] = true;
        $spress->parse();
    }
}

Another configuration values:

  • $spress['spress.config.env']: Environment name dev by default. This option determines the configuration file in case you have a specific configuration file for that environment name. e.g: $spress['spress.config.env'] = 'prod'
  • $spress['spress.config.safe']: With true disable all plugins. e.g: spress['spress.config.safe'] = true.
  • $spress['spress.config.drafts']: Include draft posts in the transformation. false by default.
  • $spress['spress.config.url']: Sets the URL base.
  • $spress['spress.config.timezone']: Sets the timezone. E.g: "Europe/Madrid".

Unit tests

Spress core uses PHPUnit >= 5.7. You can run the unit tests with the following command:

$ cd your-path
$ phpunit

License

This library is available as open source under the terms of the MIT License.