elife/patterns
Composer 安装命令:
composer require elife/patterns
包简介
eLife patterns
README 文档
README
This library provides a PHP implementation for the Mustache templates/assets produced by the eLife Sciences Pattern Library.
Dependencies
- Composer
- PHP 7
Installation
Execute composer require elife/patterns:dev-master.
Running Tests
To run all tests:
make test
To run one test:
vendor/bin/phpunit tests/src/ViewModel/ArticleSectionTest.php
Versioning
This library is not versioned as the eLife Patterns can make breaking changes at any time. It's not expected to be used by libraries, but by applications where Composer lock files are used. These tie the application to a specific commit.
Usage
Create ViewModels and pass them to a PatternRenderer, which will return the rendered template.
For example:
use eLife\Patterns\PatternRenderer\MustachePatternRenderer; $helpers = [ 'assetsPath' => '/path/to/assets', 'assetRewrite' => function (string $path, Mustache_LambdaHelper $helper) : string { return $helper->render($path).'?cache-buster'; }, ]; $mustache = new Mustache_Engine([ 'helpers' => $helpers, 'loader' => new Mustache_Loader_FilesystemLoader('/path/to/patterns-php'), ]); $patternRenderer = new MustachePatternRenderer($mustache); var_dump($patternRenderer->render($viewModel));
Updating the library
- Install Docker.
- Execute
bin/updateto update theresourcesfolder from Pattern Lab (you can pass a commit or pull request if needed, egbin/update 4303c0199112724bd5725537c7192828099018fborbin/update pr-850). - Make changes to the view models accordingly.
统计信息
- 总下载量: 12.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-02