kss 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/kss.coffee +6 -5
- data/lib/kss/modifier.rb +1 -1
- data/lib/kss/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -53,7 +53,7 @@ styleguide.section('2.1.1').modifiers.first.name
|
|
53
53
|
styleguide.section('2.1.1').modifiers.first.class_name
|
54
54
|
# => 'pseudo-class-hover'
|
55
55
|
|
56
|
-
styleguide.section('2.1.1').modifiers.first.
|
56
|
+
styleguide.section('2.1.1').modifiers.first.description
|
57
57
|
# => 'Subtle hover highlight'
|
58
58
|
|
59
59
|
```
|
data/lib/kss.coffee
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# This class scans your stylesheets for pseudo classes, then inserts a new CSS
|
2
2
|
# rule with the same properties, but named 'psuedo-class-{{name}}'.
|
3
3
|
#
|
4
|
-
# Supported pseudo classes: hover, disabled.
|
4
|
+
# Supported pseudo classes: hover, disabled, active, visited.
|
5
5
|
#
|
6
6
|
# Example:
|
7
7
|
#
|
@@ -9,15 +9,16 @@
|
|
9
9
|
# => a.pseudo-class-hover{ color:blue; }
|
10
10
|
class KssStateGenerator
|
11
11
|
constructor: ->
|
12
|
-
|
13
|
-
disabled = /:disabled/
|
12
|
+
pseudos = /(\:hover|\:disabled|\:active|\:visited)/g
|
14
13
|
|
15
14
|
try
|
16
15
|
for stylesheet in document.styleSheets
|
17
16
|
idxs = []
|
18
17
|
for rule, idx in stylesheet.cssRules
|
19
|
-
if rule.type
|
20
|
-
|
18
|
+
if (rule.type == CSSRule.STYLE_RULE) && pseudos.test(rule.selectorText)
|
19
|
+
replaceRule = (matched, stuff) ->
|
20
|
+
return ".pseudo-class-" + matched.replace(':', '')
|
21
|
+
@insertRule(rule.cssText.replace(pseudos, replaceRule))
|
21
22
|
|
22
23
|
# Takes a given style and attaches it to the current page.
|
23
24
|
#
|
data/lib/kss/modifier.rb
CHANGED
data/lib/kss/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kyle Neath
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-10 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
name: sass
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
@@ -31,7 +32,6 @@ dependencies:
|
|
31
32
|
- 1
|
32
33
|
version: "3.1"
|
33
34
|
type: :runtime
|
34
|
-
name: sass
|
35
35
|
version_requirements: *id001
|
36
36
|
description: " Inspired by TomDoc, KSS attempts to provide a methodology for writing\n maintainable, documented CSS within a team. Specifically, KSS is a CSS\n structure, documentation specification, and styleguide format.\n\n This is a ruby library for parsing KSS documented CSS and generating\n styleguides.\n"
|
37
37
|
email: kneath@gmail.com
|