Skip to content

Commit faf1f80

Browse files
committed
tutorial! part 1 - build
1 parent 699329b commit faf1f80

File tree

10 files changed

+660
-32
lines changed

10 files changed

+660
-32
lines changed

content/tutorial/build.lisp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(load "myproject.asd")
2+
3+
(ql:quickload "myproject")
4+
5+
(sb-ext:save-lisp-and-die "myproject"
6+
:executable t
7+
:toplevel #'myproject::main
8+
:compression 9)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
+++
2+
title = "Bonus: pimp your CSS"
3+
weight = 1000
4+
+++
5+
6+
## Bonus: pimp your CSS
7+
8+
Don't ask a web developer to help you with the look and feel of the
9+
app, they will bring in hundreds of megabytes of Nodejs dependencies
10+
:S We suggest a (nearly) one-liner to get a decent CSS with no
11+
efforts: by using a class-less CSS, such as
12+
[Pico](https://picocss.com/docs).
13+
14+
We only need to load it in a `<head>` tag of our app.
15+
16+
Optionally, we may write one `<div>` with a `class="container"` attribute, to have better margins.
17+
18+
So, for instance:
19+
20+
```html
21+
(defparameter *template-root* "
22+
23+
<html>
24+
<head>
25+
<link
26+
rel=\"stylesheet\"
27+
href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css\">
28+
</head>
29+
30+
<body class=\"container\">
31+
<form action=\"/\" method=\"GET\">
32+
<div>
33+
<label for=\"query\">What do you search for?</label>
34+
<input name=\"query\" id=\"query\" placeholder=\"Search…\" />
35+
</div>
36+
<div>
37+
<button>Search</button>
38+
</div>
39+
</form>
40+
41+
{% if query %}
42+
<div> query is: {{ query }} </div>
43+
44+
<ul>
45+
{% for product in results %}
46+
<li>
47+
<a href=\"/product/{{ product.0 }}\">{{ product.1 }} - {{ product.2 }}</a>
48+
</li>
49+
{% endfor %}
50+
</ul>
51+
{% endif %}
52+
</body>
53+
</html>
54+
")
55+
```
56+
57+
Note how our root template is benefiting from the CSS, and not the
58+
product page. The two pages should inherit from a base template. It's
59+
about time we setup our templates in their own directory.
60+
61+
Refresh [http://localhost:8899/?query=one](http://localhost:8899/?query=one). Do you enjoy the difference?!

0 commit comments

Comments
 (0)