https://github.com/druids/ccn
A small library for CSS class composition
https://github.com/druids/ccn
Last synced: 11 months ago
JSON representation
A small library for CSS class composition
- Host: GitHub
- URL: https://github.com/druids/ccn
- Owner: druids
- License: mit
- Created: 2018-01-12T16:48:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-09T09:49:17.000Z (over 8 years ago)
- Last Synced: 2025-07-03T03:41:30.255Z (about 1 year ago)
- Language: Clojure
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
CCN (Compose Class Name)
========================
A small library for CSS class composition, it supports both Clojure and ClojureScript.
[](https://circleci.com/gh/druids/ccn)
[](https://jarkeeper.com/druids/ccn)
[](https://opensource.org/licenses/MIT)
Leiningen/Boot
--------------
```clojure
[ccn "0.1.1"]
```
Documentation
-------------
```clojure
(require '[ccn.core :as ccn])
```
### bem
Composes a CSS class for an element with modifiers by BEM methodology.
```clojure
(ccn/bem "block" ["modifier1" "modifier2"])
"block block--modifier1 block--modifier2"
(ccn/bem "block" "element" ["modifier1" "modifier2"])
"block__element block__element--modifier1 block__element--modifier2"
(ccn/bem "block" [nil])
"block"
```
### css-class
Composes a CSS class from given args, removes blanks.
```clojure
(ccn/css-class "foo" nil "")
"foo"
(ccn/css-class "foo" "bar")
"foo bar"
```
### twbs
Composes a CSS class in Twitter Bootstrap way. It handles special cases like `disabled`.
```clojure
(ccn/twbs "table" ["responsive" nil ""])
"table table-responsive"
(ccn/twbs "btn" ["primary" "disabled"])
"disabled btn btn-primary"
```