shel/neos-themebuilder
Composer 安装命令:
composer require shel/neos-themebuilder
包简介
A plugin for NeosCMS which provides integrator/editor tools to define and use themes.
README 文档
README
This is a Neos CMS plugin for managing themes with CSS variables from the backend and for simplifying rendering of style attributes in AFX.
By defining theme properties in a NodeType mixin, these can be configured on the homepage or subpages and used to globally control your projects look & feel, or to allow choosing styles for individual elements from the defined properties. Think of defining various colors, spacings, font sizes, etc. in a theme and using them in your project.
This results in a flexible way to provide freedom and yet consistency in the design of your project.
Features
- Define theme properties by extending a common NodeType mixin with property presets
- Set theme properties in pages inheriting this mixin
- Use theme properties in other elements via property presets using an included data source
- Merged CSS variables for the current page are automatically rendered into the head of the document
Installation
Install the package via composer in your site package:
composer require --no-update shel/neos-theme-builder
Then run composer update shel/neos-theme-builder in your project root.
It is suggested to also install shel/neos-colorpicker in the same way to have a color picker for the theme properties.
Usage
Define theme properties
Add additional properties to your theme mixin NodeType:
Shel.Neos.ThemeBuilder:Mixin.PageTheme: properties: primaryColor: options: preset: 'themeBuilder.colorPicker' ui: label: 'Primary color' inspector: group: 'themeMain'
Then extend your page NodeType with this mixin:
'Vendor.Site:Document.Page': superTypes: 'Shel.Neos.ThemeBuilder:Mixin.PageTheme': true
Now you can set the primary color in the inspector tab with the sun icon of your page and use the
value in your project via CSS variable var(--primary-color).
You can find all generated CSS variables in the head of your html document contained in a style tag.
By applying the mixin to any page you can also have local overrides for landing pages or other special pages.
Use theme properties in other elements
You can use the theme properties in other elements by using the themeBuilder.colorSelector preset.
Example:
'Vendor.Site:Content.MyComponent': properties: color: options: preset: 'themeBuilder.colorSelector' ui: label: 'Color'
This will render a select box in the inspector with all available colors from the theme properties.
Helpers
Generate CSS from props for style attributes
Define styles f.e. as private prop in a component and use it in the AFX template:
prototype(My.Vendor:Content.MyComponent) < prototype(Neos.Fusion:Component) {
myStyleProp = 'red'
@private.style = Shel.Neos.ThemeBuilder:Helper.Styles {
--my-prop = '20px'
--my-prop-2 = ${props.myStyleProp}
color = 'blue'
}
renderer = afx`
<div style={private.style}>Some test</div>
`
}
This will render the following HTML:
<div style="--my-prop: 20px; --my-prop-2: red; color: blue;">Some test</div>
Note: Empty or null values will be filtered out automatically, so you don't need conditions for standard cases.
Format values
You can use the ThemeBuilder Eel helper to format values like pixels, percentages and degrees:
prototype(My.Vendor:Content.MyComponent) < prototype(Neos.Fusion:Component) {
borderRadius = ${q(node).property('borderRadius')}
width = ${q(node).property('width')}
gradientAngle = ${q(node).property('gradientAngle')}
@private.style = Shel.Neos.ThemeBuilder:Helper.Styles {
--border-radius = ${ThemeBuilder.formatPixels(props.borderRadius)}
--width = ${ThemeBuilder.formatPercentage(props.width)}
--gradient-angle = ${ThemeBuilder.formatDegrees(props.gradientAngle)}
}
renderer = afx`
<div style={private.style}>Some test</div>
`
}
Contributions
Contributions are very welcome!
Please create detailed issues and PRs.
shel/neos-themebuilder 适用场景与选型建议
shel/neos-themebuilder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 408 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「theme」 「editor」 「Neos」 「colorpicker」 「neoscms」 「themebuilder」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shel/neos-themebuilder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shel/neos-themebuilder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shel/neos-themebuilder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An improved history backend module for Neos
Create link to static resources with cache-breaking segment based on md5 of the file
Adds more BBCode
Allows changing uploaded asset filenames in Neos CMS
A Bootstrap 4.x base theme for SilverStripe
This package provides your visitors the possibility to comment stuff and discuss together.
统计信息
- 总下载量: 408
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2025-02-26