3 ms·
I am very interested in the s-expression stylesheet format. I think it would be preferable for me at least to CSS, especially the code for alternating rows; I i
by ue_ 9y ago
I am very interested in the s-expression stylesheet format. I think it would be preferable for me at least to CSS, especially the code for alternating rows; I imagine that people write programs in this language might have well done away with the need for CSS preprocessors that we have today. This also makes me ask a question - why are there no Lisp-like CSS preprocessors?
I am reminded of the proposal to markup webpages with s-expressions rather than XML, though there are packages available (actually just macros) in CL that let you write websites this awy.
- pcwalton 9y agoBe careful what you wish for. The fact that CSS can be so easily declaratively analyzed is the reason why it can be made reasonably fast at all. CSS has some key restrictions—for instance, that attributes always inherit top-down and never bottom-up—that makes it amenable to parallelism (which is no longer a theoretical concern, as parallel CSS implementations are starting to ship). Adding a full programming language would have the potential to make styling much slower than it already is.
- littlestymaar 9y ago> as parallel CSS implementations are Is someone else outside mozilla ready to ship a parallel CSS engine any time soon ?
- pcwalton 9y agoNot that I'm aware of.
- minikomi 9y agoYou might want to check out Garden [0], a meta-css library for clojure(script). [0] https://github.com/noprompt/garden https://github.com/noprompt/garden
- juki 9y agoThere is also LASS[1] for Common Lisp. You use it either as a library for generating CSS, or as a standalone preprocessor. [1]: https://github.com/Shinmera/LASS https://github.com/Shinmera/LASS
- zeveb 9y agoJust think: were HTML replaced with SXML, JavaScript with Common Lisp & CSS with something like LASS, we might have pages which look like this: (html (head (style (let ((bg #x0088ee) (fg #x00ee88)) (body (background bg) (foreground fg)) (body.inverted (foreground fg) (background bg)))) (script (defun invert () (with-slots (class-list) (get-element-by-tag document 'body) (setf class-list (if (find 'inverted class-list) (remove 'inverted class-list) (cons 'inverted class-list))))))) (body (button (@ (on-click (invert))) "Click me") (p "This is some text."))) I contend that this is a massive improvement.