theme/cssvariables 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

theme/cssvariables

Composer 安装命令:

composer require theme/cssvariables

包简介

Provide an option to overwrite CSS Variables from within Neos

README 文档

README

⚠️ This package is experimental! Use at your own risk!

What is does...

This Neos package provides a backend module giving users with access to the module to create a custom stylesheet with CSS custom properties (a.k.a. CSS-variables) based on the custom properties that are found in the Public folder of the site.

The custom stylesheet is then loaded after the defined stylesheets via Fusion (so it is configurable if loading doesn't work out of the box).

The result? A custom version of the website 😉.

The application tries to make an educated guess on the type of variable (color, font, breakpoint). Each of those can be enabled via the Settings.yaml. (See below).

What happens in the background?

The module reads all CSS files and extracts all variables declared inside the :root selector. If multiple files are found (for example when using a bootstrap based theme) the array of variables get merged where the top level file is considered to be the most relevant one.

When you change the values a new css file is being created and store inside the Data/Persistent/Theme/CssVariables folder. It is then symlinked inside the Public resources folder of the Theme.CssVariables package.

It is loaded as well, if it exists, and is merged as last so the module shows the active settings for the variables.

Optionally you can restore the defaults by removing the file.

Installation

Install by running:

composer require theme/cssvariables

Configuration

Settings

Setting Type Default value Explanation
stylesheetName string custom.css The name of the file to be generated.
types array color Supported are: color,font,breakpoint,other. Where other means every variable we could not sensibly map to one of the others.

Fusion

Default the newly created CSS-file is placed with @position = 'after stylesheets'. If your Neos Page setup is different, make sure the file is loaded after your Site's css files.

Access to the module

Our default policy is set for Neos Administrators only. However feel free to copy-paste the contents to your site package Policy.yaml and change it to whatever role you deem necessary.

Please be aware of one thing though: if more then one user can change the variables they need not be surprised when some of the other users might pick a color they think is 💩!

FAQ

My css doesn't use CSS custom properties, can I still use this package?

Lot's of sites are build using SCSS and the Sass variables (i.e. $primary-color). When compiling the CSS the variable is substituted by it's value, and not like with the css custom properties as a reference. The result is hardcoded values and renders changing the CSS custom properties kinda useless...

But... before we forget about the fun: there is an experimental feature that reads your compiled css file and looks for all values that could be substituted by a reference. You can try it out by running ./flow theme:replaceColorVariables.

As you guessed by the name, we currently only support substitution of variables that are considered to be color references. (Mainly for stability reasons).

A backup of your original CSS file is created, so feel free to give it a try!

Something is not working as expected, what should I do?

If you run into any issues, feel free to create a pull request or raise an issue. Please be as specific as possible and then a litte more... 😉

theme/cssvariables 适用场景与选型建议

theme/cssvariables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 110 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 theme/cssvariables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 theme/cssvariables 我们能提供哪些服务?
定制开发 / 二次开发

基于 theme/cssvariables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 110
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-17