clsx-rails 3.0.0 → 3.0.1
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/CHANGELOG.md +6 -0
- data/README.md +14 -13
- data/lib/clsx/rails/version.rb +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62267a91d9e4596cd5a4da9cf8569a0ac6420e6eb4368a099b64ed3a07e7bc18
|
|
4
|
+
data.tar.gz: a0d7c426b1aeea779d70a5a10cc800f9de7c5376cc3fcf5c27ae409c8ee07097
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0f10f1585daeeae9872a3e07faff6e427c453709dce9e2d698f9dca89073068eb0080fcf28c6a2d4d023c2fa68ecaf5810cdcaa12bc0728c868f88cb8c34fda
|
|
7
|
+
data.tar.gz: e3a77cfc660fe7295027d7447394c0b37602ba077ab6ea77c5d19cafdaa90109d1dd69d1128f3f8e504703fd996a3ced922d8185a1a4669656360df647de7e7f
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## v3.0.1 (2026-02-27)
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Require clsx-ruby >= 1.1.3 for correct deduplication behavior
|
|
13
|
+
- Updated benchmark numbers to reflect current performance (2-4x faster)
|
|
14
|
+
|
|
9
15
|
## v3.0.0 (2026-02-13)
|
|
10
16
|
|
|
11
17
|
### Added
|
data/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# clsx-rails [](https://rubygems.org/gems/clsx-rails) [](https://app.codecov.io/gh/svyatov/clsx-rails) [](https://github.com/svyatov/clsx-rails/actions?query=workflow%3ACI) [](LICENSE.txt)
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> The fastest conditional CSS class builder for Rails — 2-4x faster drop-in replacement for `class_names`.
|
|
4
|
+
> Powered by [clsx-ruby](https://github.com/svyatov/clsx-ruby).
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Adds `clsx` and `cn` helpers to all views automatically.
|
|
6
7
|
|
|
7
8
|
## Quick Start
|
|
8
9
|
|
|
@@ -28,16 +29,16 @@ That's it — `clsx` and `cn` are now available in all your views:
|
|
|
28
29
|
|
|
29
30
|
### Faster
|
|
30
31
|
|
|
31
|
-
**
|
|
32
|
+
**2-4x faster** than Rails `class_names` across every scenario:
|
|
32
33
|
|
|
33
34
|
| Scenario | clsx | Rails `class_names` | Speedup |
|
|
34
35
|
|---|---|---|---|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
| Hash |
|
|
40
|
-
|
|
|
36
|
+
| String array | 1.2M i/s | 317K i/s | **3.9x** |
|
|
37
|
+
| Multiple strings | 1.3M i/s | 346K i/s | **3.8x** |
|
|
38
|
+
| Single string | 2.3M i/s | 812K i/s | **2.9x** |
|
|
39
|
+
| Mixed types | 901K i/s | 331K i/s | **2.7x** |
|
|
40
|
+
| Hash | 1.7M i/s | 684K i/s | **2.4x** |
|
|
41
|
+
| String + hash | 1.2M i/s | 550K i/s | **2.1x** |
|
|
41
42
|
|
|
42
43
|
<sup>Ruby 4.0.1, Apple M1 Pro. Reproduce: `bundle exec ruby benchmark/run.rb`</sup>
|
|
43
44
|
|
|
@@ -47,7 +48,7 @@ That's it — `clsx` and `cn` are now available in all your views:
|
|
|
47
48
|
|---|---|---|
|
|
48
49
|
| Conditional classes | yes | yes |
|
|
49
50
|
| Auto-deduplication | yes | yes |
|
|
50
|
-
|
|
|
51
|
+
| 2-4x faster | yes | no |
|
|
51
52
|
| Returns `nil` when empty | yes | no (returns `""`) |
|
|
52
53
|
| Complex hash keys | yes | no |
|
|
53
54
|
| Short `cn` alias | yes | no |
|
|
@@ -196,9 +197,9 @@ Ruby 3.2+ and Rails 7.2+.
|
|
|
196
197
|
## Development
|
|
197
198
|
|
|
198
199
|
```bash
|
|
199
|
-
bin/setup
|
|
200
|
-
bundle exec rake test
|
|
201
|
-
bundle exec ruby benchmark/run.rb
|
|
200
|
+
bin/setup # install dependencies
|
|
201
|
+
bundle exec rake test # run tests
|
|
202
|
+
bundle exec ruby benchmark/run.rb # run benchmarks
|
|
202
203
|
```
|
|
203
204
|
|
|
204
205
|
## Contributing
|
data/lib/clsx/rails/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: clsx-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leonid Svyatov
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -30,6 +30,9 @@ dependencies:
|
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '1.1'
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 1.1.3
|
|
33
36
|
type: :runtime
|
|
34
37
|
prerelease: false
|
|
35
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -37,8 +40,12 @@ dependencies:
|
|
|
37
40
|
- - "~>"
|
|
38
41
|
- !ruby/object:Gem::Version
|
|
39
42
|
version: '1.1'
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 1.1.3
|
|
46
|
+
description: Build CSS class strings from conditional expressions, hashes, arrays,
|
|
47
|
+
or nested structures. 2-4x faster drop-in replacement for Rails class_names. Supports
|
|
48
|
+
ViewComponent, Phlex, and Tailwind CSS.
|
|
42
49
|
email:
|
|
43
50
|
- leonid@svyatov.com
|
|
44
51
|
executables: []
|
|
@@ -54,7 +61,6 @@ homepage: https://github.com/svyatov/clsx-rails
|
|
|
54
61
|
licenses:
|
|
55
62
|
- MIT
|
|
56
63
|
metadata:
|
|
57
|
-
homepage_uri: https://github.com/svyatov/clsx-rails
|
|
58
64
|
source_code_uri: https://github.com/svyatov/clsx-rails
|
|
59
65
|
changelog_uri: https://github.com/svyatov/clsx-rails/blob/main/CHANGELOG.md
|
|
60
66
|
rubygems_mfa_required: 'true'
|
|
@@ -74,5 +80,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
80
|
requirements: []
|
|
75
81
|
rubygems_version: 4.0.6
|
|
76
82
|
specification_version: 4
|
|
77
|
-
summary:
|
|
83
|
+
summary: The fastest conditional CSS class builder for Rails
|
|
78
84
|
test_files: []
|