Spress is a static site generator built with Symfony components and Twig as default template engine. This repository is the core of Spress application.
Go to your app folder and input the following command:
composer require spress/spress-core
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();
}
}
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();
}
}
$spress['spress.config.env']
: Environment namedev
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']
: Withtrue
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".
Spress core uses PHPUnit >= 5.7. You can run the unit tests with the following command:
$ cd your-path
$ phpunit
This library is available as open source under the terms of the MIT License.