Giter Club home page Giter Club logo

kss's Introduction

Knyle Style Sheets

Inspired by TomDoc, 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. At its core, KSS is a documenting syntax for CSS.

/*
A button suitable for giving stars to someone.

: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.
.disabled          - Dims the button to indicate it cannot be used.

Styleguide 2.1.3.
*/
a.button.star{
  ...
}
a.button.star.stars-given{
  ...
}
a.button.star.disabled{
  ...
}

Ruby Library

This repository includes a ruby library suitable for parsing SASS, SCSS, and CSS documented with KSS guidelines. To use the library, include it in your project as a gem from https://rubygems.org/gems/kss. Then, create a parser and explore your KSS.

styleguide = Kss::Parser.new("#{RACK_ROOT}public/stylesheets")

styleguide.section('2.1.1')
# => <Kss::Section>

styleguide.section('2.1.1').description
# => "A button suitable for giving stars to someone."

styleguide.section('2.1.1').modifiers.first
# => <Kss::Modifier>

styleguide.section('2.1.1').modifiers.first.name
# => ':hover'

styleguide.section('2.1.1').modifiers.first.class_name
# => 'pseudo-class-hover'

styleguide.section('2.1.1').modifiers.first.description
# => 'Subtle hover highlight'

The library is also fully TomDoc'd, completing the circle of life.

Generating styleguides

The documenting syntax and ruby 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).

For an example of how to generate a styleguide, check out the example sinatra application.

Development

To hack on KSS, you'll need to install dependencies with bundle install. Run tests with rake.

To make your life easier, I suggest bundle install --binstubs and adding bin/ to your $PATH. If you don't understand this, just blindly add bundle exec in front of everything you'd normally do, like bundle exec rake.

I apologize on behalf of the Ruby community for this, it's embarrassing and disappointing that dependency management is still so clumsy.

kss's People

Contributors

kneath avatar alanhogan avatar derekr avatar gilesbowkett avatar heikki avatar dasch avatar d2s avatar begriffs avatar josh avatar lennart avatar robincurry avatar tomeric avatar vesan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.