1 Introduction

CL-CSS

This is a dead-simple, non validating, inline CSS generator for Common Lisp. Its goals are axiomatic syntax, simple implementation to support portability, and boilerplate reduction in CSS. Execution efficiency, and CSS validation are non-goals at the moment.

Basic Usage

Use the css function to convert a list of directives into a CSS string for output. A directive is a CSS selector, followed by a list of properties.

Compiled Usage

There will now be a file at /home/user-name/ named page-style.css that contains

"body { margin: 5px; padding: 0px; }
"

You can reference this flat file from your web-app (or host it from a non-lisp server like Apache or nginx) to save some time in generating your styles. If the directory you compile to doesn't exist, compile-css will attempt to create it before compiling the file.

A number of similar functions are provided out of the box for other transform, 3d-transform, animation and transition directive options. These include transform-origin, rotate, scale, skew and matrix, perspective, perspective-origin, keyframes, animation and transition. The list is not exhaustive, even in terms of new CSS3 selectors, let alone abstracting directives for older browsers, but it should be fairly straightforward to define more of your own (feel free to send appropriate patches if you do end up using other directives).

Noted bad stuff or non-goals

No validation is done. If you provide the incorrect number of arguments, you'll get an error, but if you try something like (css '((body :magrin 5px))) or (inlne-css '(:margin 5 :padding 5)), you'll get no help.