class_variants 0.0.8 → 1.1.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/LICENSE +1 -1
- data/lib/class_variants/action_view/helpers.rb +2 -2
- data/lib/class_variants/configuration.rb +11 -0
- data/lib/class_variants/helper.rb +23 -0
- data/lib/class_variants/instance.rb +104 -38
- data/lib/class_variants/version.rb +1 -1
- data/lib/class_variants.rb +10 -0
- data/lib/generators/class_variants/install/USAGE +2 -0
- data/lib/generators/class_variants/install/install_generator.rb +11 -0
- data/lib/generators/class_variants/install/templates/class_variants.rb.tt +8 -0
- data/readme.md +255 -25
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcbc4e2fd078ac3b22bd391226eec4fc4429bcee10237613f1736bfcff08b6f
|
4
|
+
data.tar.gz: 4101b943cfd16a259d52e978c3081788451fcd1336ae44644b027aeebb1a4f34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dd5e798a846188944d4fe74342414ccfa180ba6fa319a0e1f2b0ab775f4c32c4d0a5c1129a42c52dce44765cd981db20b5a222b6605989ade32e39a7693fb5f
|
7
|
+
data.tar.gz: e3eb94faf2f8ad63b6d96fe322b274c77e8a4b2e9fcc2123e267d2b6580398fd06122b73841dbd1a1aea9709667b1afec8ab8c3bce3eecfb4db7e6d409907a76
|
data/LICENSE
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module ClassVariants
|
2
|
+
module Helper
|
3
|
+
module ClassMethods
|
4
|
+
def class_variants(...)
|
5
|
+
singleton_class.instance_variable_get(:@_class_variants_instance).merge(...)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.included(base)
|
10
|
+
base.extend(ClassMethods)
|
11
|
+
base.singleton_class.instance_variable_set(:@_class_variants_instance, ClassVariants::Instance.new)
|
12
|
+
base.define_singleton_method(:inherited) do |subclass|
|
13
|
+
subclass.singleton_class.instance_variable_set(
|
14
|
+
:@_class_variants_instance, base.singleton_class.instance_variable_get(:@_class_variants_instance).dup
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def class_variants(...)
|
20
|
+
self.class.singleton_class.instance_variable_get(:@_class_variants_instance).render(...)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,66 +1,132 @@
|
|
1
1
|
module ClassVariants
|
2
2
|
class Instance
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
3
|
+
def initialize(...)
|
4
|
+
@bases = []
|
5
|
+
@variants = []
|
6
|
+
@defaults = {}
|
7
|
+
|
8
|
+
merge(...)
|
9
|
+
end
|
10
|
+
|
11
|
+
def dup
|
12
|
+
self.class.new.tap do |copy|
|
13
|
+
copy.instance_variable_set(:@bases, @bases.dup)
|
14
|
+
copy.instance_variable_set(:@variants, @variants.dup)
|
15
|
+
copy.instance_variable_set(:@defaults, @defaults.dup)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def merge(**options, &block)
|
20
|
+
raise ArgumentError, "Use of hash config and code block is not supported" if !options.empty? && block_given?
|
21
|
+
|
22
|
+
(base = options.fetch(:base, nil)) && @bases << {class: base, slot: :default}
|
23
|
+
@variants += [
|
24
|
+
expand_variants(options.fetch(:variants, {})),
|
25
|
+
expand_compound_variants(options.fetch(:compound_variants, []))
|
26
|
+
].inject(:+)
|
27
|
+
@defaults.merge!(options.fetch(:defaults, {}))
|
28
|
+
|
29
|
+
instance_eval(&block) if block_given?
|
30
|
+
|
31
|
+
self
|
21
32
|
end
|
22
|
-
# rubocop:enable Naming/VariableName
|
23
33
|
|
24
|
-
def render(**overrides)
|
34
|
+
def render(slot = :default, **overrides)
|
35
|
+
classes = overrides.delete(:class)
|
36
|
+
result = []
|
37
|
+
|
25
38
|
# Start with our default classes
|
26
|
-
|
39
|
+
@bases.each do |base|
|
40
|
+
result << base[:class] if base[:slot] == slot
|
41
|
+
end
|
27
42
|
|
28
43
|
# Then merge the passed in overrides on top of the defaults
|
29
|
-
|
44
|
+
criteria = @defaults.merge(overrides)
|
30
45
|
|
31
|
-
|
32
|
-
|
33
|
-
result << @variants.dig(variant_type, variant)
|
34
|
-
end
|
46
|
+
@variants.each do |candidate|
|
47
|
+
next unless candidate[:slot] == slot
|
35
48
|
|
36
|
-
|
37
|
-
|
38
|
-
result << compound_variant[:class]
|
49
|
+
if (candidate.keys - [:class, :slot]).all? { |key| criteria[key] == candidate[key] }
|
50
|
+
result << candidate[:class]
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
54
|
+
# add the passed in classes to the result
|
55
|
+
result << classes
|
56
|
+
|
42
57
|
# Compact out any nil values we may have dug up
|
43
58
|
result.compact!
|
44
59
|
|
45
60
|
# Return the final token list
|
46
|
-
result.join
|
61
|
+
with_classess_processor(result.join(" "))
|
47
62
|
end
|
48
63
|
|
49
64
|
private
|
50
65
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
66
|
+
def base(klass = nil, &block)
|
67
|
+
raise ArgumentError, "Use of positional argument and code block is not supported" if klass && block_given?
|
68
|
+
|
69
|
+
if block_given?
|
70
|
+
with_slots(&block).each do |slot|
|
71
|
+
@bases << slot
|
72
|
+
end
|
73
|
+
else
|
74
|
+
@bases << {slot: :default, class: klass}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def variant(**options, &block)
|
79
|
+
raise ArgumentError, "Use of class option and code block is not supported" if options.key?(:class) && block_given?
|
80
|
+
|
81
|
+
if block_given?
|
82
|
+
with_slots(&block).each do |slot|
|
83
|
+
@variants << options.merge(slot)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
@variants << options.merge(slot: :default)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def defaults(**options)
|
91
|
+
@defaults = options
|
92
|
+
end
|
93
|
+
|
94
|
+
def slot(name = :default, **options)
|
95
|
+
raise ArgumentError, "class option is required" unless options.key?(:class)
|
96
|
+
|
97
|
+
@slots << options.merge(slot: name)
|
98
|
+
end
|
99
|
+
|
100
|
+
def with_slots
|
101
|
+
@slots = []
|
102
|
+
yield
|
103
|
+
@slots
|
104
|
+
end
|
105
|
+
|
106
|
+
def expand_variants(variants)
|
107
|
+
variants.flat_map do |property, values|
|
108
|
+
case values
|
54
109
|
when String
|
55
|
-
|
56
|
-
{s_key.delete_prefix("!").to_sym => {!s_key.start_with?("!") => value}}
|
110
|
+
{property.to_s.delete_prefix("!").to_sym => !property.to_s.start_with?("!"), :class => values, :slot => :default}
|
57
111
|
else
|
58
|
-
|
112
|
+
values.map do |key, value|
|
113
|
+
{property => key, :class => value, :slot => :default}
|
114
|
+
end
|
59
115
|
end
|
60
116
|
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def expand_compound_variants(compound_variants)
|
120
|
+
compound_variants.map do |compound_variant|
|
121
|
+
compound_variant.merge(slot: :default)
|
122
|
+
end
|
123
|
+
end
|
61
124
|
|
62
|
-
|
63
|
-
|
125
|
+
def with_classess_processor(classes)
|
126
|
+
if ClassVariants.configuration.process_classes_with.respond_to?(:call)
|
127
|
+
ClassVariants.configuration.process_classes_with.call(classes)
|
128
|
+
else
|
129
|
+
classes
|
64
130
|
end
|
65
131
|
end
|
66
132
|
end
|
data/lib/class_variants.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
require "class_variants/version"
|
2
2
|
require "class_variants/action_view/helpers"
|
3
|
+
require "class_variants/configuration"
|
3
4
|
require "class_variants/instance"
|
5
|
+
require "class_variants/helper"
|
4
6
|
require "class_variants/railtie" if defined?(Rails)
|
5
7
|
|
6
8
|
module ClassVariants
|
7
9
|
class << self
|
10
|
+
def configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(&block)
|
15
|
+
yield(configuration)
|
16
|
+
end
|
17
|
+
|
8
18
|
def build(...)
|
9
19
|
Instance.new(...)
|
10
20
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ClassVariants
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("templates", __dir__)
|
5
|
+
|
6
|
+
def copy_initializer
|
7
|
+
template "class_variants.rb", "config/initializers/class_variants.rb"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/readme.md
CHANGED
@@ -8,7 +8,6 @@ Inspired by [variant-classnames](https://github.com/mattvalleycodes/variant-clas
|
|
8
8
|
|
9
9
|
* [DRY up your tailwind CSS using this awesome gem](https://www.youtube.com/watch?v=cFcwNH6x77g)
|
10
10
|
|
11
|
-
|
12
11
|
## Installation
|
13
12
|
|
14
13
|
Add this line to your application's Gemfile:
|
@@ -34,36 +33,38 @@ $ gem install class_variants
|
|
34
33
|
We create an object from the class or helper where we define the configuration using four arguments:
|
35
34
|
|
36
35
|
1. The `base` keyword argument with default classes that should be applied to each variant.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
## Example
|
36
|
+
2. The `variants` keyword argument where we declare the variants with their option and classes.
|
37
|
+
3. The `compound_variants` keyword argument where we declare the compound variants with their conditions and classes
|
38
|
+
4. The `defaults` keyword argument (optional) where we declare the default value for each variant.
|
42
39
|
|
43
|
-
Below we implement the [button component](https://tailwindui.com/components/application-ui/elements/buttons) from Tailwind UI.
|
40
|
+
Below we'll implement the [button component](https://tailwindui.com/components/application-ui/elements/buttons) from Tailwind UI.
|
44
41
|
|
45
42
|
```ruby
|
46
43
|
# Define the variants and defaults
|
47
44
|
button_classes = ClassVariants.build(
|
48
45
|
base: "inline-flex items-center rounded border border-transparent font-medium text-white hover:text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2",
|
49
46
|
variants: {
|
47
|
+
color: {
|
48
|
+
indigo: "bg-indigo-600 hover:bg-indigo-700 focus:ring-indigo-500",
|
49
|
+
red: "bg-red-600 hover:bg-red-700 focus:ring-red-500",
|
50
|
+
blue: "bg-blue-600 hover:bg-blue-700 focus:ring-blue-500",
|
51
|
+
},
|
50
52
|
size: {
|
51
53
|
sm: "px-2.5 py-1.5 text-xs",
|
52
54
|
md: "px-3 py-2 text-sm",
|
53
55
|
lg: "px-4 py-2 text-sm",
|
54
56
|
xl: "px-4 py-2 text-base",
|
55
57
|
},
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
},
|
58
|
+
compound_variants: [
|
59
|
+
{ color: :red, border: true, class: "border-red-800" },
|
60
|
+
{ color: :blue, border: true, class: "border-blue-800" }
|
61
|
+
]
|
61
62
|
# A variant whose value is a string will be expanded into a hash that looks
|
62
63
|
# like { true => "classes" }
|
63
|
-
|
64
|
+
icon: "w-full justify-center",
|
64
65
|
# Unless the key starts with !, in which case it will expand into
|
65
66
|
# { false => "classes" }
|
66
|
-
"!
|
67
|
+
"!icon": "w-auto",
|
67
68
|
},
|
68
69
|
defaults: {
|
69
70
|
size: :md,
|
@@ -78,7 +79,7 @@ button_classes.render
|
|
78
79
|
button_classes.render(color: :red, size: :xl, icon: true)
|
79
80
|
```
|
80
81
|
|
81
|
-
|
82
|
+
## Compound Variants
|
82
83
|
|
83
84
|
```ruby
|
84
85
|
button_classes = ClassVariants.build(
|
@@ -100,11 +101,185 @@ button_classes.render(color: :red) # => "inline-flex items-center rounded bg-red
|
|
100
101
|
button_classes.render(color: :red, border: true) # => "inline-flex items-center rounded bg-red-600 border border-red-600"
|
101
102
|
```
|
102
103
|
|
104
|
+
## Override classes with `render`
|
105
|
+
|
106
|
+
We can also override the builder classes in the `render` method.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
button_classes = ClassVariants.build(
|
110
|
+
base: "inline-flex items-center rounded",
|
111
|
+
variants: { ... },
|
112
|
+
)
|
113
|
+
|
114
|
+
button_classes.render(color: :red, class: "block")
|
115
|
+
```
|
116
|
+
|
117
|
+
Now, the `block` class will be appended to the classes bus.
|
118
|
+
|
119
|
+
If you're using the [`tailwind_merge`](#tailwind_merge) plugin it will override the `inline-flex` class.
|
120
|
+
|
121
|
+
## Block configurations
|
122
|
+
|
123
|
+
You might have scenarios where you have more advanced conditionals and you'd like to configure the classes using the block notation.
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
alert_classes = ClassVariants.build do
|
127
|
+
# base
|
128
|
+
base "..."
|
129
|
+
|
130
|
+
# variant
|
131
|
+
variant color: :red, class: "..."
|
132
|
+
|
133
|
+
# compound variant
|
134
|
+
variant type: :button, color: :red, class: "..."
|
135
|
+
|
136
|
+
# defaults
|
137
|
+
defaults color: :red, type: :button
|
138
|
+
end
|
139
|
+
|
140
|
+
# usage
|
141
|
+
alert_classes.render(color: :red, type: :button)
|
142
|
+
```
|
143
|
+
|
144
|
+
## Slots
|
145
|
+
|
146
|
+
You might have components which have multiple slots or places where you'd like to use conditional classes.
|
147
|
+
`class_variants` supports that through slots.
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
# Example
|
151
|
+
|
152
|
+
alert_classes = ClassVariants.build do
|
153
|
+
# base with slots
|
154
|
+
base do
|
155
|
+
slot :head, class: "..."
|
156
|
+
slot :body, class: "..."
|
157
|
+
end
|
158
|
+
|
159
|
+
# variant with slots
|
160
|
+
variant color: :red do
|
161
|
+
slot :head, class: "..."
|
162
|
+
slot :body, class: "..."
|
163
|
+
end
|
164
|
+
|
165
|
+
# compound variant with slots
|
166
|
+
variant type: :button, color: :red do
|
167
|
+
slot :head, class: "..."
|
168
|
+
slot :body, class: "..."
|
169
|
+
end
|
170
|
+
|
171
|
+
# set defaults
|
172
|
+
defaults color: :red, type: :button
|
173
|
+
end
|
174
|
+
```
|
175
|
+
|
176
|
+
```erb
|
177
|
+
<div>
|
178
|
+
<div class="<%= alert_classes.render(:head) %>">
|
179
|
+
Head of alert
|
180
|
+
</div>
|
181
|
+
<div class="<%= alert_classes.render(:body) %>">
|
182
|
+
Body of alert
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
```
|
186
|
+
|
187
|
+
## Merge definitions
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
alert_classes = ClassVariants.build(base: "bg-white")
|
191
|
+
alert_classes.merge(base: "text-black")
|
192
|
+
alert_classes.render # => "bg-white text-black"
|
193
|
+
```
|
194
|
+
|
195
|
+
## Full API
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# Configuration
|
199
|
+
alert_classes = ClassVariants.build(
|
200
|
+
base: "...",
|
201
|
+
variants: {
|
202
|
+
color: {
|
203
|
+
red: "...",
|
204
|
+
black: "..."
|
205
|
+
},
|
206
|
+
type: {
|
207
|
+
button: "...",
|
208
|
+
link: "..."
|
209
|
+
}
|
210
|
+
},
|
211
|
+
compound_variants: [],
|
212
|
+
defaults: {
|
213
|
+
color: :red,
|
214
|
+
type: :button
|
215
|
+
}
|
216
|
+
) do
|
217
|
+
# base without slots
|
218
|
+
base "..."
|
219
|
+
|
220
|
+
# base with slots
|
221
|
+
base do
|
222
|
+
slot :head, class: "..."
|
223
|
+
slot :body, class: "..."
|
224
|
+
end
|
225
|
+
|
226
|
+
# variant without slots
|
227
|
+
variant color: :red, class: "..."
|
228
|
+
|
229
|
+
# variant with slots
|
230
|
+
variant color: :red do
|
231
|
+
slot :head, class: "..."
|
232
|
+
slot :body, class: "..."
|
233
|
+
end
|
234
|
+
|
235
|
+
# compound variant without slots
|
236
|
+
variant type: :button, color: :red, class: "..."
|
237
|
+
|
238
|
+
# compound variant with slots
|
239
|
+
variant type: :button, color: :red do
|
240
|
+
slot :head, class: "..."
|
241
|
+
slot :body, class: "..."
|
242
|
+
end
|
243
|
+
|
244
|
+
# option 1 (my favorite)
|
245
|
+
defaults color: :red, type: :button
|
246
|
+
|
247
|
+
# option 2
|
248
|
+
defaults do
|
249
|
+
color :red
|
250
|
+
type :button
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Usage
|
255
|
+
|
256
|
+
# renders the defaults
|
257
|
+
alert_classes.render
|
258
|
+
|
259
|
+
# render default slot with custom variants
|
260
|
+
alert_classes.render(color: :red)
|
261
|
+
|
262
|
+
# render slot with defaults variants
|
263
|
+
alert_classes.render(:body)
|
264
|
+
|
265
|
+
# render slot with custom variants
|
266
|
+
alert_classes.render(:body, color: :red)
|
267
|
+
|
268
|
+
# if slot not exist, throw error? return empty classes?
|
269
|
+
alert_classes.render(:non_existent_slot, color: :red)
|
270
|
+
|
271
|
+
# render default slot with custom class (will be merged)
|
272
|
+
alert_classes.render(class: "...")
|
273
|
+
|
274
|
+
# render slot with custom class (will be merged)
|
275
|
+
alert_classes.render(:body, class: "...")
|
276
|
+
```
|
277
|
+
|
103
278
|
## Use with Rails
|
104
279
|
|
105
280
|
```ruby
|
106
281
|
# Somewhere in your helpers
|
107
|
-
def button_classes
|
282
|
+
def button_classes
|
108
283
|
class_variants(
|
109
284
|
base: "inline-flex items-center rounded border border-transparent font-medium text-white hover:text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2",
|
110
285
|
variants: {
|
@@ -137,14 +312,68 @@ end
|
|
137
312
|
|
138
313
|
### Output
|
139
314
|
|
140
|
-

|
315
|
+
### 
|
316
|
+
|
317
|
+
## Helper module
|
318
|
+
|
319
|
+
If you're developing something more complex you might want to use composition more. You might want to use the helper module for that.
|
320
|
+
|
321
|
+
```ruby
|
322
|
+
class MyClass
|
323
|
+
include ClassVariants::Helper
|
324
|
+
|
325
|
+
class_variants(
|
326
|
+
base: "bg-white",
|
327
|
+
variants: {
|
328
|
+
color: {
|
329
|
+
red: "text-red",
|
330
|
+
blue: "text-blue"
|
331
|
+
}
|
332
|
+
}
|
333
|
+
)
|
334
|
+
end
|
335
|
+
|
336
|
+
MyClass.new.class_variants(color: :red, class: "shadow") # => "bg-white text-red shadow"
|
337
|
+
```
|
338
|
+
|
339
|
+
This helper supports class inheritance, so that the subclass receives a copy of the class_variants config that the parent class had at the time of inheritance. From that point on, the settings are kept separate for both. Successive calls to class_variants helper method, will cause the configuration to be merged.
|
340
|
+
|
341
|
+
```ruby
|
342
|
+
class A
|
343
|
+
include ClassVariants::Helper
|
344
|
+
|
345
|
+
class_variants(base: "bg-red")
|
346
|
+
end
|
347
|
+
|
348
|
+
class B < A
|
349
|
+
class_variants(base: "text-black")
|
350
|
+
end
|
351
|
+
|
352
|
+
A.class_variants(base: "text-white")
|
353
|
+
|
354
|
+
A.new.class_variants # => "bg-red text-white"
|
355
|
+
B.new.class_variants # => "bg-red text-black"
|
356
|
+
```
|
357
|
+
|
358
|
+
## `tailwind_merge`
|
359
|
+
|
360
|
+
By default, the classes are merged using `concat`, but you can use the awesome [TailwindMerge](https://github.com/gjtorikian/tailwind_merge) gem.
|
361
|
+
Install the gem using `bundle add tailwind_merge` and use this configuration to enable it. If you're using Rails, you can put this in an initializer.
|
362
|
+
|
363
|
+
```ruby
|
364
|
+
ClassVariants.configure do |config|
|
365
|
+
config.process_classes_with do |classes|
|
366
|
+
TailwindMerge::Merger.new.merge(classes)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
```
|
141
370
|
|
142
371
|
## Other packages
|
143
372
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
373
|
+
- [`active_storage-blurhash`](https://github.com/avo-hq/active_storage-blurhash) - A plug-n-play [blurhash](https://blurha.sh/) integration for images stored in ActiveStorage
|
374
|
+
- [`avo`](https://github.com/avo-hq/avo) - Build Content management systems with Ruby on Rails
|
375
|
+
- [`prop_initializer`](https://github.com/avo-hq/prop_initializer) - A flexible tool for defining properties on Ruby classes.
|
376
|
+
- [`stimulus-confetti`](https://github.com/avo-hq/stimulus-confetti) - The easiest way to add confetti to your StimulusJS app
|
148
377
|
|
149
378
|
## Try Avo ⭐️
|
150
379
|
|
@@ -155,12 +384,13 @@ If you enjoyed this gem try out [Avo](https://github.com/avo-hq/avo). It helps d
|
|
155
384
|
## Contributing
|
156
385
|
|
157
386
|
1. Fork it `git clone https://github.com/avo-hq/class_variants`
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
387
|
+
2. Create your feature branch `git checkout -b my-new-feature`
|
388
|
+
3. Commit your changes `git commit -am 'Add some feature'`
|
389
|
+
4. Push to the branch `git push origin my-new-feature`
|
390
|
+
5. Create new Pull Request
|
162
391
|
|
163
392
|
## License
|
393
|
+
|
164
394
|
This package is available as open source under the terms of the MIT License.
|
165
395
|
|
166
396
|
## Cutting a release
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: class_variants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easily configure styles and apply them as classes.
|
14
14
|
email: adrian@adrianthedev.com
|
@@ -19,9 +19,14 @@ files:
|
|
19
19
|
- LICENSE
|
20
20
|
- lib/class_variants.rb
|
21
21
|
- lib/class_variants/action_view/helpers.rb
|
22
|
+
- lib/class_variants/configuration.rb
|
23
|
+
- lib/class_variants/helper.rb
|
22
24
|
- lib/class_variants/instance.rb
|
23
25
|
- lib/class_variants/railtie.rb
|
24
26
|
- lib/class_variants/version.rb
|
27
|
+
- lib/generators/class_variants/install/USAGE
|
28
|
+
- lib/generators/class_variants/install/install_generator.rb
|
29
|
+
- lib/generators/class_variants/install/templates/class_variants.rb.tt
|
25
30
|
- readme.md
|
26
31
|
homepage: https://github.com/avo-hq/class_variants
|
27
32
|
licenses:
|