https://github.com/panthevm/cleancss
is a tool that removes unused CSS stylesheets
https://github.com/panthevm/cleancss
clojure clojurescript css
Last synced: 2 months ago
JSON representation
is a tool that removes unused CSS stylesheets
- Host: GitHub
- URL: https://github.com/panthevm/cleancss
- Owner: Panthevm
- License: mit
- Created: 2021-01-09T19:06:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-09T18:15:51.000Z (about 4 years ago)
- Last Synced: 2025-04-11T04:41:58.107Z (2 months ago)
- Topics: clojure, clojurescript, css
- Language: Clojure
- Homepage:
- Size: 5.88 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CleanCSS
[](https://clojars.org/cleancss)
CleanCSS - Clojure/ClojureScript tool that removes unused CSS
## Quickstart
1) Add a dependency
```edn
cleancss/cleancss {:mvn/version "2.0.0"}
```2) Call the `cleancss.watcher/create` at the start of the app.
```clojure
(defonce develop
(cleancss.watcher/create
{;; A list of source directories to be watched
:watch-dirs ["src"]:build
{;; Directory with css source files
:import {:directory "resources/public/css/src"}
;; The directory where the cached data will be stored
:cache {:directory "resources/public/css/out"}
;; Output file
:export {:file "resources/public/css/clean.css"}}}))```
3) Mark class names and identifiers with literals
```clojure
[:div {:id #i"id-foo"
:class [#c"class-bar"
#c"class-baz"]}
"Hello"]
```
[Example (Figwheel)](https://github.com/Panthevm/cleancss/tree/main/example)
# Configuration#### `:default` - manually specifying selectors (optional)
```clojure
(cleancss.watcher/create
{;; ...
:default
{:types #{"*" "html" "body" "div"}
:classes #{"container"}
:pseudos #{":hover"}
:functions #{":lang"}
:identifiers #{"id"}
:attributes #{["type" "button"]
["href" "#"]
["lang"]}}
;; ...
})
```