flashbackzoo/silverstripe-pattern-library
Composer 安装命令:
composer require flashbackzoo/silverstripe-pattern-library
包简介
Framework agnostic pattern library generator for Silverstripe
README 文档
README
Framework agnostic pattern library generator for Silverstripe.
Getting started
Install the module
composer require flashbackzoo/silverstripe-pattern-library
Assuming you have a Vue3 component like this
themes/app/src/ExampleComponent.vue
<script> import { defineComponent } from '@vue/composition-api'; export default defineComponent({ props: { content: { type: String, required: true, }, }, }); </script> <template> <div> {{ content }} </div> </template>
And a Silverstripe template for your component like this
themes/app/templates/Includes/ExampleComponent.ss
<div> <h1>$Title</h1> <example-component :content="$Content.XML" /> </div>
You can add some config like this
app/_config/pattern-library.yml
--- Name: app-pattern-library After: - '#flashbackzoo-pattern-library' --- Flashbackzoo\SilverstripePatternLibrary\PatternLibrary: engine: Flashbackzoo\SilverstripePatternLibrary\Engine\StorybookV6 adapter: Flashbackzoo\SilverstripePatternLibrary\Adapter\StorybookVue3 static_dir: ./themes/app/dist output: ./stories patterns: - ./app/pattern-library/example-component.yml
app/pattern-library/example-component.yml
ExampleComponent: title: Components/ExampleComponent component: name: ExampleComponent element: example-component path: ../themes/app/src/ExampleComponent.vue template: name: Includes\ExampleComponent data: Title: Hello world! Content: XML: args.content args: content: > '<p>This is my component.</p>'
Run the build task
/dev/tasks/Flashbackzoo-SilverstripePatternLibrary-GeneratePatternLibraryTask?flush=1
This should generate a story in your output directory like
stories/ExampleComponent.stories.js
import ExampleComponent from '../themes/app/src/ExampleComponent.vue'; export default { title: 'ExampleComponent', component: ExampleComponent, }; const Template = (args) => ({ components: { 'example-component': ExampleComponent, }, setup() { return { args }; }, template: ` <div> <h1>Hello world!</h1> <example-component :content="args.content" /> </div> `, }); export const Primary = Template.bind({}); Primary.args = { content: '<p>This is my component.</p>', };
Not all components require JavaScript, for example footers are often just Silverstripe templates, without any complex interactions. You can generate patterns for "Silverstripe only" components too.
app/pattern-library/footer.yml
Footer: title: Components/Footer template: name: Includes\Footer data: Columns: - Menu: MenuTitle: Column 1 MenuItems: - Title: Example link 1 Link: '#' - Title: Example link 2 Link: '#' - Menu: MenuTitle: Column 2 MenuItems: - Title: Example link 3 Link: '#' - Title: Example link 4 Link: '#'
The module supports having a mix of generated and manually created stories in your project. This means you can gradually convert your existing stories to generates ones. And you can still write manual stories if required.
flashbackzoo/silverstripe-pattern-library 适用场景与选型建议
flashbackzoo/silverstripe-pattern-library 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 232 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 05 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「silverstripe」 「pattern library」 「storybook」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 flashbackzoo/silverstripe-pattern-library 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flashbackzoo/silverstripe-pattern-library 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 flashbackzoo/silverstripe-pattern-library 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
A Laravel package for the Repository Design Pattern.
Analytics chooser extensions for site settings.
统计信息
- 总下载量: 232
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-05-07