benmanu / silverstripe-simple-styleguide
提供了一个厨房水槽模板,非常适合主题开发。
Requires
- silverstripe/cms: ^5.0
Requires (Dev)
- phpunit/phpunit: ^9.6
README
简单风格指南使网站维护者能够通过单页获取通用网站样式(如排版、链接、颜色、表单字段等)。通过主题模板扩展,可以构建出特定于网站的组件库。
概述
该模块添加了一个新的控制器端点,可以通过 /_styleguide
路由查看,如果登录具有管理员权限,或从开发环境查看。还提供了一个厨房水槽模板,可用于或由您的网站主题覆盖以显示前端和排版组件。
SimpleStyleguideController
类还包括一个基本表单(SimpleStyleguideController::TestForm()
)和 HTMLText 输出(SimpleStyleguideController::getContent()
),用于测试框架输出。
安装
在命令行运行
$ composer require benmanu/silverstripe-simple-styleguide
或在项目的 composer.json
中包含 "benmanu/silverstripe-simple-styleguide": "^2.0"
并运行
$ composer update
使用 1.0
标签为 SilverStripe 3 网站提供。
使用
可以通过在主题的 template/Layout/
目录中包含 SimpleStyleguideController.ss
文件来覆盖风格指南模板。
可以使用 SilverStripe 的 扩展 来覆盖 SimpleStyleguideController
类,以便添加新输出函数或修改提供的函数,通过使用 updateStyleguideData
扩展钩子。
风格指南数据
通过 updateStyleguideData
可用扩展钩子覆盖/编辑渲染的模板数据。
颜色样本
提供了一个简单的颜色样本模板,可以通过 color_swatches
配置值进行覆盖。
BenManu\SimpleStyleguide\SimpleStyleguideController: color_swatches: - Name: "Black" Description: "This color is rather dark" CSSColor: "#000000" TextColor: "#ffffff" - Name: "Grey" Description: "This color is grey" CSSColor: "#666666" TextColor: "#000000"
占位符图像
可以通过 placeholder_image_url
配置覆盖占位符图像 URL。
BenManu\SimpleStyleguide\SimpleStyleguideController: placeholder_image_url: "/simple-styleguide/images/placeholder.png"