Skip to content

jjk-jacky/Spress

 
 

Repository files navigation

Spress - PHP Static site generator

Build Status Build status Scrutinizer Code Quality Code Coverage SensioLabsInsight

Spress is a static site generator built with Symfony components. See demo.

License: MIT.

Requirements

  • Linux, Unix, Mac OS X or Windows.
  • PHP >= 5.5.
  • Composer.

Community

Discuss and share your opinions in Gitter chat:

![Gitter](https://badges.gitter.im/Join Chat.svg)

Contributing

When Contributing code to Spress, you must follow its coding standards. Spress follows PSR-2 coding style.

Keep in mind a golden rule: Imitate the existing Spress code.

Pull Resquests

  • Fork the Spress repository.
  • Create a new branch for each feature or improvement.
  • Send a pull request from each feature branch to master branch or appropriated.

Unit testing

All pull requests must be accompanied by passing unit tests. Spress uses phpunit for testing.

Getting Started

  • Download the last release or clone repository git clone https://github.com/spress/Spress.git.
  • Get vendors
  • Create a blank site.
  • Build your site.

Get vendors

Use Composer to get vendors:

$ cd your-path
$ composer.phar update

spress command

Spress command are located in bin/spress and you can use this command to create a new site or process your site.

site:build

Build your site in your configured destination, typically _site.

site:Build 	[-s|--source="./"] [--timezone="..."] [--env="dev"]
			[--server] [--watch] [--drafts]
			[--safe]
  • --server The built-in server will run.
  • --watch Watch for changes and regenerate your site automatically.
  • --drafts To include draft posts in the generated site.
  • --safe Disable all plugins.

E.g $ spress site:build -s /your-site-dir

How to load configuration for production environment:
  1. To create config_prod.yml with the options that will be overrided in config.yml.
  2. $ spress site:build --env=prod

Scaffolding

new:site

Create a new site.

new:site [path="./"] [template="blank"] [--force] [--all]

  • --force option force to use the path even though exists and it's not empty.
  • --all In blank template, creates the complete scaffold.

E.g $ spress new:site /your-site-dir

new:post

The new:post command helps you generates new posts. By default, the command interacts with the developer to tweak the generation. Any passed option will be used as a default value for the interaction.

new:post 	[--title="..."] [--layout="default"] [--date="..."]
			[--tags="..."] [--categories="..."]`
  • --title: The title of the post.
  • --layout: The layout of the post.
  • --date: The date assigned to the post.
  • --tags: Comma separated list of tags.
  • --categories: Comma separated list of categories.
new:plugin

The new:plugin command helps you generates new plugins. By default, the command interacts with the developer to tweak the generation. Any passed option will be used as a default value for the interaction.

new:plugin 	[--name="..."] [--command-name="..."] [--command-description="..."]
			[--command-help="..."] [--author="..."] [--email="..."]
			[--description="..."] [--license="MIT"]
  • --name: The name of the plugins should follow the pattern vendor-name/plugin-name.
  • --command-name: In case of you want to create a command plugin this is the name of the command.
  • --command-description: The description of command in case of command plugin.
  • --command-help: The description of command in case of command plugin.
  • --author: The author of the plugin.
  • --email: The Email of the author.
  • --description: The description of your plugin.
  • --license: The license under you publish your plugin. MIT by default.
self-update

self-update or selfupdate command replace your spress.phar by the latest version from spress.yosymfony.com.

How to make spress.phar

We are using Box Project for generating the .phar file.

You may download Box:

$ curl -LSs https://box-project.github.io/box2/installer.php | php

Next:

$ cd spress-folder
$ box build

Unit tests

You can run the unit tests with the following command:

$ cd your-path
$ composer.phar install
$ phpunit

About

Static site generator in PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 87.9%
  • HTML 12.1%