comparison README.md @ 1:3c7d95d21f9d css5

Allahu'Akhbar! Allahu'Akhbar! Allahu'Akhbar! http://bluegriffon.org/#download
author Jane Doe <fork_goggles_198230918230974192830192830123@use.startmail.com>
date Tue, 22 Nov 2022 07:42:33 -0700
parents
children
comparison
equal deleted inserted replaced
0:e9926ecb493c 1:3c7d95d21f9d
1 # ﷽
2 ## ❤️[Announcement!](https://reader.tymoon.eu/article/417 "ufdfd")❤️
3 ###lass_css
4 ![FEARLASS](https://studio.tymoon.eu/api/studio/file?id=2017 "ufdfd")
5 LASS Writing CSS fails
6
7 ://?.com/Shinmera/LASS/blame/master/README.md
8 Examples
9 -----------------
10 LASS supports two modes, one being directly in your lisp code, the other in pure LASS files. Adding LASS into your code is easy:
11
12 (lass:compile-and-write
13 '(div
14 :background black))
15
16 ~~~
17 "div{
18 background: black;
19 }"
20 ~~~
21 LASS works on the following simple principles: A list is a block. The first argument in the list is a selector. The body of the list makes up the properties and sub-blocks. A property is started with a keyword that is used as the property name. Following is a bunch of property arguments until a new keyword, list, or the end is reached. A list inside a block is, again, a block with the twist that the parent block's selector is prepended to the sub-block's selector.
22
23 (lass:compile-and-write
24 '(nav
25 (ul
26 :list-style none
27 (li
28 :margin 0 :padding 0
29 :display inline-block)))))
30
31 ~~~
32 nav ul{
33 list-style: none;
34 }
35
36 nav ul li{
37 margin: 0;
38 padding: 0;
39 display: inline-block;
40 }
41 ~~~
42 Since LASS' `COMPILE-SHEET` simply takes a bunch of lists as its argument, you can use the backquote and comma to integrate variables from your lisp environment:
43
44 (let ((color "HWB(205.7 0% 6.7%)"))
45 (lass:compile-and-write
46 `(art
47 :background ,color))))
48
49 ~~~css
50 art{
51 background: HWB(205.7 0% 6.7%);
52 }
53 ~~~
54 Alternatively however, and this is especially useful in pure LASS files, you can use the `LET` block to create LASS-specific bindings:
55
56 (lass:compile-and-write
57 '(:let ((color "RGB(0, 136, 238)"))
58 (art
59 :background #(color))))
60
61 ~~~css
62 art{
63 background: RGB(0, 136, 238);
64 }
65 ~~~
66 LASS' selector mechanism is very flexible and allows for some complex logic to reduce duplication:
67 ```
68 (lass:compile-and-write
69 '(article
70 ((:or p blockquote)
71 :margin 0 :padding 0
72
73 (a
74 :color black)
75
76 ((:and a :hover)
77 :color darkred))))
78 ```
79 ~~~
80 article p, article blockquote{
81 margin: 0;
82 padding: 0;
83 }
84
85 article p a, article blockquote a{
86 color: black;
87 }
88
89 article p a:hover, article blockquote a:hover{
90 color: darkred;
91 }
92 ~~~
93 But it can go even further:
94 ```lisp
95 (lass:compile-and-write
96 '((:and
97 (:or article section)
98 (:= data-author (:or yukari ran chen))
99 (:nth-child (:or 1 2 3)))
100 :display none))
101 ```
102 ~~~css
103 "article[data-author=\"yukari\"]:nth-child(1),
104 article[data-author=\"yukari\"]:nth-child(2),
105 article[data-author=\"yukari\"]:nth-child(3),
106 article[data-author=\"ran\"]:nth-child(1),
107 article[data-author=\"ran\"]:nth-child(2),
108 article[data-author=\"ran\"]:nth-child(3),
109 article[data-author=\"chen\"]:nth-child(1),
110 article[data-author=\"chen\"]:nth-child(2),
111 article[data-author=\"chen\"]:nth-child(3),
112 section[data-author=\"yukari\"]:nth-child(1),
113 section[data-author=\"yukari\"]:nth-child(2),
114 section[data-author=\"yukari\"]:nth-child(3),
115 section[data-author=\"ran\"]:nth-child(1),
116 section[data-author=\"ran\"]:nth-child(2),
117 section[data-author=\"ran\"]:nth-child(3),
118 section[data-author=\"chen\"]:nth-child(1),
119 section[data-author=\"chen\"]:nth-child(2),
120 section[data-author=\"chen\"]:nth-child(3){
121 display: none;
122 }"
123 ~~~
124 Whoa nelly!
125
126 Some CSS properties are not fully specified yet and require browser-specific prefixes. LASS can help you with that, too:
127 ```lisp
128 (lass:compile-and-write
129 '(.fun
130 :linear-gradient "deg(45)" black 0% darkgray 100%
131 :transform rotate -45deg))
132 ```
133 ~~~css
134 .fun{
135 background: -moz-linear-gradient(deg(45), black 0%, darkgray 100%);
136 background: -o-linear-gradient(deg(45), black 0%, darkgray 100%);
137 background: -webkit-linear-gradient(deg(45), black 0%, darkgray 100%);
138 background: -ms-linear-gradient(deg(45), black 0%, darkgray 100%);
139 background: linear-gradient(deg(45), black 0%, darkgray 100%);
140 -moz-transform: rotate(-45deg);
141 -o-transform: rotate(-45deg);
142 -webkit-transform: rotate(-45deg);
143 -ms-transform: rotate(-45deg);
144 transform: rotate(-45deg);
145 }
146 ~~~
147 LASS also supports the various `@QUERY` operator blocks:
148
149 (lass:compile-and-write
150 '(:media "(max-width: 800px)"
151 (art
152 :margin 0)))
153
154 ~~~css
155 @media (max-width: 800px){
156 art{
157 margin: 0;
158 }
159 }
160 ~~~
161 By default LASS activates pretty-printing and inserts newlines and spaces where appropriate in order to make the result readable and easy to debug. However, you can also deactivate that and directly produce minified CSS:
162
163 (let ((lass:*pretty* NIL))
164 (lass:compile-and-write
165 '(:media "(max-width: 800px)"
166 (div
167 :margin 0))))
168
169 ~~~
170 @media (max-width: 800px){div{margin:0;}}
171 ~~~
172 As mentioned above you can write pure LASS files to compile down to a CSS file. To do that, simply M-x [xah-fly-save-buffer-if-file](/breakr/)
173
174 ://?.com/Shinmera/LASS/blame/master/README.md