Liking cljdoc? Tell your friends :D

GenTW

Generate a Tailwind CSS output file from Clojure.

A couple use cases:

  • Generate Tailwind CSS as a build step for Clojure web projects.
  • Start a watch process in your REPL to re-generate CSS during development.

Requirements

  1. Assumes yarn is installed on the $PATH.
  2. Assumes the Tailwind CLI has already been installed. If it's not, see here for installation instructions.
  3. Assumes an input.css file exists in the project to configure Tailwind. If not, see the Tailwind CLI installation instructions from the last requirement.

Usage

Unless provided, input.css is expected to be in the working directory. Unless provided, generates CSS to output.css in the working directory.

REPL Usage

Include in your deps.edn as follows: Clojars Project

Require in your REPL:

(require '[io.cvcf.gentw :as tw])

Generate CSS:

(tw/build :output (io/file "target" "css" "styles.css"))

; Alternatively:
(tw/build
 :in  "config.css" ; or whatever your input file is called
 :out (io/file "target" "css" "styles.css"))

Generate a release (minified and optimized) build of the CSS:

(tw/release :output (io/file "target" "css" "styles.css"))

; Alternatively:
(tw/release
 :in  "config.css" ; or whatever your input file is called
 :out (io/file "target" "css" "styles.css"))

Watch the project for changes and re-generate CSS, as needed:

(tw/watch :output (io/file "target" "css" "styles.css"))

; Alternatively:
(tw/watch
 :in  "config.css" ; or whatever your input file is called
 :out (io/file "target" "css" "styles.css"))

The above cases should cover most use cases but, if not, there is the more general:

(tw/generate-css
 :watch?    false        ; watch the project for changes
 :optimize? false        ; optimize generated output
 :minify?   false        ; minify generated output
 :in        "config.css" ; or whatever your input file is called
 :out       (io/file "target" "css" "styles.css"))

CLI Usage

Generate a minified, optimized version of Tailwind (probably for use in production environments).

Generate CSS:

clojure -X io.cvcf.gentw/build :out "target/css/styles.css"

# Alternatively:
clojure -X io.cvcf.gentw/build :in "config.css" :out "target/css/styles.css"

Generate a release (minified and optimized) build of the CSS:

clojure -X io.cvcf.gentw/release :out "target/css/styles.css"

# Alternatively:
clojure -X io.cvcf.gentw/release :in "config.css" :out "target/css/styles.css"

Watch the project for changes and re-generate CSS, as needed:

clojure -X io.cvcf.gentw/watch :out "target/css/styles.css"

# Alternatively:
clojure -X io.cvcf.gentw/watch :in "config.css" :out "target/css/styles.css"

The above cases should cover most use cases but, if not, there is the more general:

clojure -X io.cvcf.gentw/generate-css \
  :watch?    false \
  :optimize? false \
  :minify?   false \
  :in        "config.css" \
  :out       "target/css/styles.css"

Run the project's tests (they'll fail until you edit them):

$ clojure -T:build test

Run the project's CI pipeline and build a JAR (this will fail until you edit the tests to pass):

$ clojure -T:build ci

This will produce an updated pom.xml file with synchronized dependencies inside the META-INF directory inside target/classes and the JAR in target. You can update the version (and SCM tag) information in generated pom.xml by updating build.clj.

Install it locally (requires the ci task be run first):

$ clojure -T:build install

Deploy it to Clojars -- needs CLOJARS_USERNAME and CLOJARS_PASSWORD environment variables (requires the ci task be run first):

$ clojure -T:build deploy

Your library will be deployed to io.cvcf/gentw on clojars.org by default.

License

Copyright © 2025 io.cvcf

Distributed under the Eclipse Public License version 1.0.

Can you improve this documentation?Edit on GitLab

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close