Skip to content

Commit 38cc9db

Browse files
committed
static assets: use asdf:system-relative-pathname
1 parent d532f79 commit 38cc9db

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

content/building-blocks/static.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ For example:
2020
of your :myproject system.
2121
Then reference static assets with the /static/ URL prefix."
2222
(push (hunchentoot:create-folder-dispatcher-and-handler
23-
"/static/"
24-
(merge-pathnames "src/static" ;; starts without a /
25-
(asdf:system-source-directory :myproject))) ;; <- myproject
23+
"/static/"
24+
(asdf:system-relative-pathname :myproject "src/static/"))
25+
;; ^^^ starts without a /
2626
hunchentoot:*dispatch-table*))
2727
~~~
2828

@@ -33,8 +33,20 @@ and call it in the function that starts your application:
3333
```
3434

3535
Now our project's static files located under `src/static/` are served
36-
with the `/static/` prefix, access them like this:
36+
with the `/static/` prefix. Access them like this:
3737

3838
```html
3939
<img src="/static/img/banner.jpg" />
4040
```
41+
42+
or
43+
44+
```html
45+
<script src="/static/test.js" type="text/javascript"></script>
46+
```
47+
48+
where the file `src/static/test.js` could be
49+
50+
```js
51+
console.log("hello");
52+
```

0 commit comments

Comments
 (0)