Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
clo
cl-site
Commits
8171819d
Commit
8171819d
authored
Apr 24, 2017
by
Cheshire Yang
Browse files
Add functions for including CSS files (basic, WIP)
parent
8980a330
Changes
6
Hide whitespace changes
Inline
Side-by-side
globals.lisp
View file @
8171819d
...
...
@@ -14,7 +14,7 @@
;; Location and list of styles
;; *STYLES* should be list of strings representing relative filenames.
;; @TO-DO: replace this with better css preprocessing.
(
defparameter
*STYLES-DIR*
(
asdf:system-relative-pathname
:cl-site
"
conten
t/css/"
))
(
defparameter
*STYLES-DIR*
(
asdf:system-relative-pathname
:cl-site
"
layou
t/css/"
))
(
defparameter
*STYLES*
(
list
"main.css"
))
...
...
helpers.lisp
View file @
8171819d
...
...
@@ -2,8 +2,8 @@
(
in-package
:cl-site
)
; Makes pathname from prefix + page object
(
defun
make-path
(
prefix
page
)
(
let
((
path
(
cdr
(
assoc
:content
page
)
)))
(
defun
make-path
(
prefix
suffix
&optional
page
)
(
let
((
path
(
if
page
(
cdr
(
assoc
:content
suffix
))
suffix
)))
(
if
(
pathnamep
prefix
)
(
merge-pathnames
path
prefix
)
(
pathname
(
concatenate
'string
...
...
layout/css/main.css
0 → 100644
View file @
8171819d
html
,
body
{
margin
:
0
;
padding
:
0
;
height
:
100%
;
}
*
{
box-sizing
:
border-box
;
}
.header
,
.main
{
width
:
70%
;
margin-left
:
auto
;
margin-right
:
auto
;
}
.header
{
}
\ No newline at end of file
layout/templates/primary.html
View file @
8171819d
...
...
@@ -2,12 +2,27 @@
<html>
<head>
<title>
{{title}}
</title>
{{#styles}}
<link
href=
"{{location}}"
rel=
"stylesheet"
type=
"text/css"
>
{{/styles}}
</head>
<body>
<header>
Site Title
</header>
<header
class=
"header"
>
</header>
<main
class=
"main"
>
<aside
class=
"sidebar"
>
Sidebar
</aside>
{{page-content}}
<section
class=
"content"
>
{{page-content}}
</section>
</main>
</body>
</html>
main.lisp
View file @
8171819d
...
...
@@ -2,4 +2,6 @@
(
in-package
:cl-site
)
(
defun
make-site
()
(
process-pages
))
\ No newline at end of file
(
progn
(
process-styles
)
(
process-pages
)))
\ No newline at end of file
process.lisp
View file @
8171819d
...
...
@@ -2,7 +2,15 @@
(
in-package
:cl-site
)
;; Copies/renders stylesheets + adds to global context
(
defun
process-styles
()
)
(
defun
process-styles
()
(
let
((
styles-list
(
mapcar
(
lambda
(
s
)
(
progn
(
uiop:copy-file
(
make-path
*STYLES-DIR*
s
)
(
make-path
*OUTPUT-DIR*
s
))
(
cons
:location
s
)))
*STYLES*
)))
(
push
(
cons
:styles
styles-list
)
*GLOBAL-CONTEXT*
)))
;; Copies/renders static assets (imgs, etc)
(
defun
process-static
()
)
...
...
@@ -11,15 +19,16 @@
;; process-pages : Copies/renders pages - called last
(
defun
render-page
(
page
template-path
)
(
let*
((
page-path
(
make-path
*PAGES-DIR*
page
))
(
output-path
(
make-path
*OUTPUT-DIR*
page
))
((
page-path
(
make-path
*PAGES-DIR*
page
t
))
(
output-path
(
make-path
*OUTPUT-DIR*
page
t
))
(
page-content
(
file-to-string
page-path
))
(
page-context
(
remove-if
(
lambda
(
p
)
(
find
p
*PRIVATE-KEYS*
))
(
push
(
cons
:page-content
page-content
)
page
)
:key
'car
)))
(
with-open-file
(
output-stream
output-path
:direction
:output
:if-exists
:supersede
)
(
mustache:render
template-path
page-context
output-stream
))))
(
mustache:render
template-path
(
append
page-context
*GLOBAL-CONTEXT*
)
output-stream
))))
(
defun
process-pages
()
(
let
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment