new KssStyleguide(data)
An instance of this class is returned on finishing kss.traverse
.
Exposes convenience methods for interpreting data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The data object generated by traverse. |
- Source:
Methods
getWeight(reference, index) → {int}
Helper function for KssStyleguide.sortSections()
that gets the weight of the
given reference at the given depth.
Parameters:
Name | Type | Description |
---|---|---|
reference |
string | A section reference. |
index |
int | The requested depth. |
- Source:
Returns:
The requested weight.
- Type
- int
section(query) → {false|KssSection|Array}
Search for sections within the style guide.
There's a few ways to use this method:
section()
returns all of the sections.
Using strings:
section('2')
returns Section 2.section('2.*')
returns Section 2 and all of its descendants.section('2.x')
returns Section 2's children only.section('2.x.x')
returns Section 2's children, and their children too.
Or Regular Expressions:
section(/2\.[1-5]/)
returns Sections 2.1 through to 2.5.
Parameters:
Name | Type | Description |
---|---|---|
query |
string | Regexp | A string or Regexp object to match a KssSection's style guide reference. |
- Source:
Returns:
The exact KssSection requested, an array of KssSection objects matching the query, or false.
- Type
- false | KssSection | Array
sortSections()
Sorts the sections of the style guide.
This is called automatically when the KssStyleguide object is created, but is publicly accessible as well.
- Source: