2017 © Pedro Peláez
 

library kss-php

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

image

kss-php/kss-php

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  • Monday, December 12, 2016
  • by janiv
  • Repository
  • 2 Watchers
  • 19 Stars
  • 30,485 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 21 Versions
  • 8 % Grown

The README.md

Knyle Style Sheets

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., (*1)

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., (*2)

/*
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., (*3)

<?php

require_once('../vendors/autoload.php');
$styleguide = new \Kss\Parser('public/stylesheets');

$section = $styleguide->getSection('Buttons - Star Button');
// Returns a \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 \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)., (*4)

For an example of how to generate a styleguide, check out the example php pages., (*5)

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:, (*6)

$ 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:, (*7)

$ 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] (https://github.com/kss-php/KssBundle) as well. The KSS Bundle uses Twig templates to make the styleguide block easier to customize and include in your views., (*8)

The Versions

12/12 2016

dev-master

9999999-dev

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

12/12 2016

v2.0.1

2.0.1.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

16/04 2015

v2.0.0

2.0.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

18/08 2014

v1.0.0

1.0.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

02/08 2014

v0.8.3

0.8.3.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/08 2014

v0.8.2

0.8.2.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/08 2014

v0.8.1

0.8.1.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/08 2014

v0.8.0

0.8.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

21/07 2014

v0.7.0

0.7.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

11/11 2013

v0.6.0

0.6.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

06/07 2013

v0.5.2

0.5.2.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

03/06 2013

v0.5.1

0.5.1.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/03 2013

v0.5.0

0.5.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

04/02 2013

v0.4.4

0.4.4.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/02 2013

v0.4.3

0.4.3.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

01/02 2013

v0.4.2

0.4.2.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

31/01 2013

v0.4.1

0.4.1.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

30/01 2013

v0.4.0

0.4.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

30/01 2013

v0.3.0

0.3.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

29/01 2013

v0.2.0

0.2.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation

29/01 2013

v0.1.0

0.1.0.0

A PHP implementation of KSS: a methodology for documenting CSS and generating styleguides

  Sources   Download

MIT

The Requires

 

The Development Requires

styleguide kss css documentation