ucss 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +20 -2
- data/lib/ucss.rb +14 -4
- data/ucss.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f1fdff2f5b763b1b87ae73debae30aa1021029cc0409e9ce0ea60a22b04600
|
4
|
+
data.tar.gz: 89b93dc7a60c094e1ffcd0b98d8481d8a66466125140001af40c80d64e8ce2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fffbb88d70160721b9f407b7b787c099a32efe1a705a2aed69deb3566931bfd466a99662f8e75ca7a9d12bae7414237e778294822b91f53d82dfc70070bba88
|
7
|
+
data.tar.gz: 2b2772c01a957b5c633dfc953116f0dd235d6af03dc64db5755adb40aa895d58cd741954140a8d06710bd2c2b7b09d0ef1de649db04e32ae8a9165c435b15a5f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -39,13 +39,31 @@ div class: "flex gap-#{gap}" do
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
|
-
That won't work, here's
|
42
|
+
That won't work, here's one way to get it working:
|
43
43
|
|
44
44
|
```ruby
|
45
|
-
gap =
|
45
|
+
gap = 0
|
46
46
|
gaps = ['gap-1']
|
47
47
|
|
48
48
|
div class: "flex #{gaps[gap]}" do
|
49
49
|
'this is an element'
|
50
50
|
end
|
51
51
|
```
|
52
|
+
|
53
|
+
or you could do one better:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
def vstack(options = {}, &block)
|
57
|
+
div class: "flex flex-row flex-auto items-center #{options[:class]}" do
|
58
|
+
yield block if block
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
vstack(class: 'gap-1') do
|
63
|
+
div '1'
|
64
|
+
div '2'
|
65
|
+
div '3'
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
69
|
+
This is assuming you use markaby of course and you're trying to come up with re-usable bits of html.
|
data/lib/ucss.rb
CHANGED
@@ -3,7 +3,8 @@ require_relative 'spacing'
|
|
3
3
|
require_relative 'hash'
|
4
4
|
|
5
5
|
class UCss
|
6
|
-
REGEX = /[
|
6
|
+
REGEX = /[^<>"'`\s]*[^<>"'`\s:]/.freeze
|
7
|
+
|
7
8
|
|
8
9
|
def self.spacing(properties)
|
9
10
|
SPACING.transform_values do |v|
|
@@ -41,6 +42,8 @@ class UCss
|
|
41
42
|
CLASS_MAP = {
|
42
43
|
'bg' => colors('background'),
|
43
44
|
'p' => spacing(['padding']),
|
45
|
+
'py' => spacing(%w[padding-top padding-bottom]),
|
46
|
+
'px' => spacing(%w[padding-left padding-right]),
|
44
47
|
'm' => spacing(['margin']),
|
45
48
|
'my' => spacing(%w[margin-top margin-bottom]),
|
46
49
|
'mx' => spacing(%w[margin-left margin-right]),
|
@@ -72,10 +75,17 @@ class UCss
|
|
72
75
|
}
|
73
76
|
}.merge(COLORS).freeze
|
74
77
|
|
78
|
+
@@classes = []
|
79
|
+
|
80
|
+
def self.css(str)
|
81
|
+
@@classes << str.split(' ').compact
|
82
|
+
@@classes.flatten!.uniq!
|
83
|
+
end
|
84
|
+
|
75
85
|
def initialize
|
76
86
|
@output = './assets/css/utility.css'
|
77
87
|
@input = './views/**/*.*'
|
78
|
-
@matches = []
|
88
|
+
@matches = @@classes || []
|
79
89
|
end
|
80
90
|
|
81
91
|
def body(name)
|
@@ -99,10 +109,10 @@ class UCss
|
|
99
109
|
|
100
110
|
files.each do |f|
|
101
111
|
s = File.read f
|
102
|
-
@matches
|
112
|
+
@matches += s.scan(REGEX)
|
103
113
|
end
|
104
114
|
|
105
|
-
@matches
|
115
|
+
@matches.uniq!
|
106
116
|
end
|
107
117
|
|
108
118
|
def write(to: @output)
|
data/ucss.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|