scan/kss-php
最新稳定版本:v1.0.0
Composer 安装命令:
composer require scan/kss-php
包简介
A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides
README 文档
README
This is a PHP implementation of Knyle Style Sheets (KSS). KSS attempts to provide a methodology for writing maintainable, documented CSS within a team. Specifically, KSS is a documentation specification and styleguide format. It is not a preprocessor, CSS framework, naming convention, or specificity guideline.
KSS in a nutshell
The methodology and ideas behind Knyle Style Sheets are contained in SPEC.md of the origin ruby version of KSS. At its core, KSS is a documenting syntax for CSS.
/*
A button suitable for giving stars to someone.
Markup: <a class="button star $modifierClass">Button</a>
:hover - Subtle hover highlight.
.stars--given - A highlight indicating you've already given a star.
.stars--given:hover - Subtle hover highlight on top of stars-given styling.
.stars--disabled - Dims the button to indicate it cannot be used.
Styleguide Buttons - Star Button
*/
a.button.star {
...
}
a.button.star:hover {
...
}
a.button.stars--given {
...
}
a.button.stars--given:hover {
...
}
a.button.stars--disabled {
...
}
PHP Library
This repository includes a php library suitable for parsing SASS, SCSS, and CSS documented with KSS guidelines. To use the library, include it in your project as a composer dependency (see below). Then, create a parser and explore your KSS.
<?php
require_once('../vendors/autoload.php');
$styleguide = new \Scan\Kss\Parser('public/stylesheets')
$section = $styleguide->getSection('Buttons - Star Button');
// Returns a \Scan\Kss\Section object
echo $section->getTitle();
// Echoes "Star Button"
echo $section->getDescription();
// echoes "A button suitable for giving stars to someone."
echo $section->getMarkup();
// echoes "<a class="button star $modifierClass">Button</a>"
$modifier = current($section->getModifiers());
// Returns a \Scan\Kss\Modifier object
echo $modifier->getName();
// echoes ':hover'
echo $modifier->getClassName();
// echoes 'psuedo-class-hover'
echo $modifier->getDescription();
// echoes 'Subtle hover highlight'
echo $modifier->getExampleHtml();
// echoes <a class="button stars stars-given">Button</a> for the .stars-given modifier
Generating styleguides
The documenting syntax and php library are intended to generate styleguides automatically. To do this, you'll need to leverage a small javascript library that generates class styles for pseudo-class styles (:hover, :disabled, etc).
- kss.coffee
- kss.js (compiled js)
For an example of how to generate a styleguide, check out the example php pages.
Dependencies
The PHP version of KSS has dependencies managed by Composer. If you did not install kss-php using composer, you must install these dependencies manually before using the library by running the following commands:
$ composer install
If you do not yet have Composer, download it following the instructions on http://getcomposer.org or run the following commands to install it globally on your system:
$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
Symfony2 Bundle
If your project uses symfony2, consider using the KSS Bundle as well. The KSS Bundle uses Twig templates to make the styleguide block easier to customize and include in your views.
scan/kss-php 适用场景与选型建议
scan/kss-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 106.8k 次下载、GitHub Stars 达 87, 最近一次更新时间为 2013 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kss」 「styleguide」 「css documentation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 scan/kss-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scan/kss-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 scan/kss-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides
Provides a kitchen sink template useful for theme development.
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides
Generates a styleguide for a SilverStripe theme
统计信息
- 总下载量: 106.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 89
- 点击次数: 23
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-01-28