Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.56 KB

0023-softdrink.org

File metadata and controls

62 lines (42 loc) · 1.56 KB

softdrink

This is a small library by @shinmera. It is able to extract CSS from HTML or embed it back.

“Softdrink” could be useful, for example, to produce HTML emails. Most email software ignores external stylesheets but is able to use styles, embedded into HTML nodes.

Unfortunately, even the README examples don’t work. Probably because the library’s dependencies were changed in the last few years.

I’ve created an issue about these problems:

Shinmera/softdrink#1

Hope, @shinmera will help to figure out, how to fix the problems.

Update

Nicolas was able to fix the issue very quickly. You can install a fixed version from:

https://ultralisp.org

Let’s try how it works!

The first example shows how to extract CSS from HTML:

POFTHEDAY> (softdrink:slurp "<div>
                               <foo/>
                               <foo id=\"bla\"
                                    style=\"foo: bar; blah: minor\" />
                             </div>")
"div>#bla{
    foo: bar;
    blah: minor;
}"

The second example embeds CSS into HTML and renders it into the string:

POFTHEDAY> (softdrink:pour
            (softdrink:mix
             "<foo>
                <p>Hello Lisp World!</p>
              </foo>"
             ;; This is a style to embed into HTML
             '(p :text-decoration underline)))

"<foo>
                <p style=\"text-decoration:underline;\">Hello Lisp World!</p>
              </foo>"

Great! Everything work like expected!