2017 © Pedro Peláez
 

library couscous

image

couscous/couscous

  • Tuesday, June 5, 2018
  • by mnapoli
  • Repository
  • 36 Watchers
  • 659 Stars
  • 29,836 Installations
  • PHP
  • 30 Dependents
  • 0 Suggesters
  • 88 Forks
  • 37 Open issues
  • 29 Versions
  • 5 % Grown

The README.md


layout: home

Couscous generates a GitHub pages website from your markdown documentation., (*1)

Build Status Average time to resolve an issue Percentage of issues still open, (*2)

Everything is documented on couscous.io., (*3)

What follows is the documentation for contributors., (*4)

How Couscous works?

Couscous was designed to be as simple as possible. By embracing simplicity, it becomes extremely simple to extend., (*5)

Website generation

The website generation is composed of a list of steps to process the Project model object:, (*6)

interface Step
{
    /**
     * Process the given project.
     *
     * @param Project $project
     */
    public function __invoke(Project $project);
}

Steps are very granular, thus extremely easy to write and test. For example:, (*7)

  • LoadConfig: load the couscous.yml config file
  • InstallDependencies: install the dependencies (using yarn, npm or bower)
  • LoadMarkdownFiles: load the content of all the *.md files in memory
  • RenderMarkdown: render the markdown content
  • WriteFiles: write the in-memory processed files to the target directory

For example, here is a step that would preprocess Markdown files to put the word "Couscous" in bold:, (*8)

class PutCouscousInBold implements \Couscous\Step
{
    public function __invoke(Project $project)
    {
        /** @var MarkdownFile[] $markdownFiles */
        $markdownFiles = $project->findFilesByType('Couscous\Model\MarkdownFile');

        foreach ($markdownFiles as $file) {
            $file->content = str_replace('Couscous', '**Couscous**', $file->content);
        }
    }
}

Couscous uses PHP-DI for wiring everything together with dependency injection., (*9)

The full list of steps is configured in src/Application/config.php., (*10)

Website deployment

Couscous deploys by cloning (in a temp directory) the current repository, checking out the gh-pages branch, generating the website inside it, committing and pushing., (*11)

In the future, Couscous will support several deployment strategies., (*12)

Contributing

See the CONTRIBUTING file., (*13)

License

Couscous is released under the MIT License., (*14)

The Versions