Skip to content

wilkerlucio/tailwind-garden

Repository files navigation

Tailwind Garden Clojars Project cljdoc badge

This library contains a copy of the CSS described by TailwindCSS documentation pages, ported to the Garden syntax.

The CSS was manually ported (copied and pasted + editor macros to convert syntax) and in case Tailwind changes, manual changes will be required to be done here as well.

That said, this doesn't have any dependency on any JS library, everything is self-contained here.

Using Tailwind Garden

To use all the Tailwind CSS:

(ns my-app
  (:require [com.wsscode.tailwind-garden.core :as tw]))

(def tailwind-css (tw/compute-css)) ; generate full css as string

Tailwind Garden is compatible with both Clojure and Clojurescript, in case you are making a web service and want to ship the CSS from it, you can just drop that string in some handler.

To use from Clojurescript, you can create a style tag and inject it:

(ns my-app
  (:require 
    [com.wsscode.tailwind-garden.core :as tw]
    [goog.dom :as gdom]))

(def tailwind-css (tw/compute-css))

(defn create-style-element [css]
  (doto (js/document.createElement "style")
    (gdom/appendChild (js/document.createTextNode css))))

(defn inject-css [css]
  (let [style (create-style-element css)]
    (gdom/appendChild js/document.head style)
    #(gdom/removeNode style)))

(defn main []
  ; on app mount, or whenever makes sense to inject the CSS
  (inject-css tailwind-css))

Customizing CSS

Currently, you can only choose to use or not specific components. In the future this library may provide detailed configuration of the variables.

A good way to start a custom build is to copy from the everything defined by Tailwind Garden.

Note you can also adjust the generated variants there.

Porting status

  • BASE STYLES
    • Preflight
  • LAYOUT
    • Container
    • Box Sizing
    • Display
    • Floats
    • Clear
    • Object Fit
    • Object Position
    • Overflow
    • Overscroll Behavior
    • Position
    • Top / Right / Bottom / Left
    • Visibility
    • Z-Index
  • FLEXBOX
    • Flex Direction
    • Flex Wrap
    • Flex
    • Flex Grow
    • Flex Shrink
    • Order
  • GRID
    • Grid Template Columns
    • Grid Column Start / End
    • Grid Template Rows
    • Grid Row Start / End
    • Grid Auto Flow
    • Grid Auto Columns
    • Grid Auto Rows
    • Gap
  • BOX ALIGNMENT
    • Justify Content
    • Justify Items
    • Justify Self
    • Align Content
    • Align Items
    • Align Self
    • Place Content
    • Place Items
    • Place Self
  • SPACING
    • Padding
    • Margin
    • Space Between
  • SIZING
    • Width
    • Min-Width
    • Max-Width
    • Height
    • Min-Height
    • Max-Height
  • TYPOGRAPHY
    • Font Family
    • Font Size
    • Font Smoothing
    • Font Style
    • Font Weight
    • Font Variant Numeric
    • Letter Spacing
    • Line Height
    • List Style Type
    • List Style Position
    • Placeholder Color
    • Placeholder Opacity
    • Text Align
    • Text Color
    • Text Opacity
    • Text Decoration
    • Text Transform
    • Text Overflow
    • Vertical Align
    • Whitespace
    • Word Break
  • BACKGROUNDS
    • Background Attachment
    • Background Clip
    • Background Color
    • Background Opacity
    • Background Position
    • Background Repeat
    • Background Size
    • Background Image
    • Gradient Color Stops
  • BORDERS
    • Border Radius
    • Border Width
    • Border Color
    • Border Opacity
    • Border Style
    • Divide Width
    • Divide Color
    • Divide Opacity
    • Divide Style
    • Ring Width
    • Ring Color
    • Ring Opacity
    • Ring Offset Width
    • Ring Offset Color
  • EFFECTS
    • Box Shadow
    • Opacity
  • TABLES
    • Border Collapse
    • Table Layout
  • TRANSITIONS AND ANIMATION
    • Transition Property
    • Transition Duration
    • Transition Timing Function
    • Transition Delay
    • Animation
  • TRANSFORMS
    • Transform
    • Transform Origin
    • Scale
    • Rotate
    • Translate
    • Skew
  • INTERACTIVITY
    • Appearance
    • Cursor
    • Outline
    • Pointer Events
    • Resize
    • User Select
  • SVG
    • Fill
    • Stroke
    • Stroke Width
  • ACCESSIBILITY
    • Screen Readers

All the things ported! Or almost, still missing the variants for hover, active, etc...

About

Port of Tailwind CSS library to Garden format in Clojure

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published