Giter Site home page Giter Site logo

protocol55 / styleguide Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 154 KB

Style Guide api for protocol55.kss and CLI for generating Style Guides from KSS documented CSS.

Home Page: https://protocol55.github.io/styleguide/

License: MIT License

HTML 0.32% CSS 56.21% Clojure 43.47%
clojure clojurescript css styleguide kss figwheel-main

styleguide's Introduction

Style Guide Alpha

Style Guide api for protocol55.kss and CLI for generating Style Guides from KSS documented CSS. Example Style Guide.

desktop

mobile

Installation

deps.edn

org.clojars.protocol55/styleguide {:mvn/version "0.1.1"}

Leiningen

[org.clojars.protocol55/styleguide "0.1.1"]

Usage

protocol55.styleguide.alpha/styleguide

[]
[docs]
  Returns an ordered sequence of sections of the kss documentation maps of docs
  with :reference keys.

protocol55.styleguide.alpha/add

[styleguide docs]
  Adds the kss documentation maps of docs to styleguide, returning an ordered
  sequence of sections.

protocol55.styleguide.alpha/sections-seq

[styleguide]
[base styleguide]
[base max-depth styleguide]
[base min-depth max-depth styleguide]
  Returns an ordered sequence of sections of styleguide constrained by the base,
  min-depth and max-depth values.

   base - a vector of parts the reference must contain (default [])
   max-depth - the maximum depth of the references parts (default Integer/MAX_VALUE)
   min-depth - the minimum depth of the references parts (default 0)

protocol55.styleguide.alpha/get-section-by-reference

[styleguide reference]
  Returns the section containing the :reference key reference or nil if not present.

Reference Conventions

Currently only a couple variations for references are supported. Unless you have a specific reason not to you should always use named references.

Numeric

Numeric references should be separated by a dot, start at 1 and not have zeros for any of their parts.

Valid numeric references:

  • 1
  • 1.1
  • 200.100.300

Invalid numeric references:

  • 0
  • 0.1
  • 1.0
  • 1.0.1

Named

Named references should be separated by a dot and use the following characters: A-Z a-z _.

Valid named references:

  • Components.Buttons
  • Components.Buttons.Primary
  • Components.Buttons.Button_Sizes.Small

Invalid named references:

  • Components.Buttons.Button Sizes.Small
  • Components.Buttons.Button-Sizes.Small

Custom Ordering

Using the weight property in you KSS documentation will re-order that reference within the same depth. You will most likely want to do this for your top-level named references.

Style Guide CLI

Example Style Guide

Example Style Guide Source

Features

  • Live reloading of CSS and KSS documentation (via figwheel.main)
  • Responsive default theme
  • Can generate a static build for hosting

Usage

Usage: clj -m protocol55.styleguide.main [options]

Options:
  -s, --source DIR        Source directory to recursively parse for KSS comments
  -m, --mask EXT          Extension mask for detecting files containing KSS comments
  -r, --root URI       /  Root uri of the style guide
      --css URL           URL of a CSS file to include in the style guide
      --theme-css URL     URL of a CSS file to include to override the default style guide theme
      --build-dir DIR     Builds an optimized version of the style guide into DIR
      --overview FILE     File name of the overview's Markdown file
  -h, --help

Setup

While using the CLI does not require you to write any Clojure code, you will need to put any files specified with --css or --theme-css within a public directory on the classpath. This ensures that the server started by figwheel.main will serve your files. The most minimal setup would look like the following:

example/
├── resources
│   └── public
│       └── styles.css
└── deps.edn

deps.edn

{:deps {org.clojars.protocol55/styleguide {:mvn/version "0.1.1"}}
 :paths ["resources" "target"]}

clj -m protocol55.styleguide.main -s resources/ --css styles.css

With styles.css within the public folder in the directory we added to the classpath via :paths we can now specify it using just the relative path it will be served from, which in this case is styles.css. If you had put styles.css inside a nested css directory, such as resources/public/css/styles.css, you would instead use --css css/styles.css. Note that you can link to hosted css, such as Google Fonts, by providing the full url.

We also add target to paths. figwheel.main will generate the javascript used in the style guide here inside a public folder, so it should also be on the classpath.

styleguide's People

Contributors

colinkahn avatar

Watchers

 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.