change static path to work with static content
s-ol
3 years ago
4 | 4 |
.tup
|
5 | 5 |
/.gitignore
|
6 | 6 |
/out
|
7 | |
/static
|
13 | 13 |
: mmm/.bundle.lua | <modules> |> ^ WRAP %d^ moon &(build)/bundle_module.moon %o --wrap %f |> static/mmm.bundle.lua
|
14 | 14 |
|
15 | 15 |
# copy for static builds
|
16 | |
: foreach static/* |> cp %f out/ |> out/%b
|
|
16 |
: foreach static/* |> cp %f out/.static/ |> out/.static/%b
|
76 | 76 |
501, "not implemented"
|
77 | 77 |
|
78 | 78 |
handle_static: (method, path, stream) =>
|
79 | |
path = path\match '^/%?static/(.*)'
|
|
79 |
path = path\match '^/%.static/(.*)'
|
80 | 80 |
return unless path
|
81 | 81 |
|
82 | 82 |
respond = (code, type, body) ->
|
|
92 | 92 |
respond '405', 'text/plain', "can only GET/HEAD static resources"
|
93 | 93 |
return true
|
94 | 94 |
|
95 | |
if path\match '^%.' or path\match '^%~'
|
|
95 |
if path\match '%.%.' or path\match '^%~'
|
96 | 96 |
respond '404', 'text/plain', "not found"
|
97 | 97 |
return
|
98 | 98 |
|
0 | 0 |
include_rules
|
1 | |
|
2 | 1 |
|
3 | 2 |
: foreach *.moon |> ^ MOON %f^ moonc -p > %o %f |> %B.lua <modules>
|
4 | 3 |
: <modules> |> ^ BNDL %d^ moon &(build)/bundle_module.moon %o %d %<modules> |> .bundle.lua ../<modules>
|
128 | 128 |
<!DOCTYPE html>
|
129 | 129 |
<html>
|
130 | 130 |
<head>
|
131 | |
<link rel="stylesheet" type="text/css" href="/?static/main.css" />
|
|
131 |
<link rel="stylesheet" type="text/css" href="/.static/main.css" />
|
132 | 132 |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400" />
|
133 | 133 |
]]
|
134 | 134 |
buf ..= "
|
|
142 | 142 |
#{footer}
|
143 | 143 |
"
|
144 | 144 |
buf ..= [[
|
145 | |
<script type="application/javascript" src="/?static/highlight.pack.js"></script>
|
|
145 |
<script type="application/javascript" src="/.static/highlight.pack.js"></script>
|
146 | 146 |
<script type="application/javascript" src="//cdnjs.cloudflare.com/ajax/libs/marked/0.5.1/marked.min.js"></script>
|
147 | 147 |
<script type="application/javascript" src="//cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js"></script>
|
148 | 148 |
<script type="application/javascript" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
|
149 | |
<script type="application/javascript" src="/?static/fengari-web.js"></script>
|
150 | |
<script type="application/lua" src="/?static/mmm.bundle.lua"></script>
|
|
149 |
<script type="application/javascript" src="/.static/fengari-web.js"></script>
|
|
150 |
<script type="application/lua" src="/.static/mmm.bundle.lua"></script>
|
151 | 151 |
<script type="application/lua">require 'mmm'</script>
|
152 | 152 |
]]
|
153 | 153 |
|