git.s-ol.nu mmm / 4e87b58
static rendering root prefix s-ol 3 years ago
5 changed file(s) with 18 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
77 add '?/init.server'
88
99 -- usage:
10 -- moon render_all.moon [STORE] [output] [startpath]
11 { store, output, startpath } = arg
10 -- moon render_all.moon [STORE] [output] [URL-prefix]
11 { store, output, prefix } = arg
1212
1313 require 'mmm'
1414 import Fileder, dir_base from require 'mmm.mmmfs.fileder'
2424 with io.open path, 'w'
2525 \write val
2626 \close!
27
28 root: prefix
2729 }
2830
2931 require 'mmm.mmmfs'
129129 <!DOCTYPE html>
130130 <html>
131131 <head>]]
132 buf ..= STATIC.style or [[<link rel="stylesheet" type="text/css" href="/static/style/:text/css" />]]
132 buf ..= if STATIC then STATIC.style else [[<link rel="stylesheet" type="text/css" href="/static/style/:text/css" />]]
133133 buf ..= [[<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,600" />]]
134134 buf ..= "
135135 #{get_meta fileder}
00 extensions = {
11 'image/jpeg': 'jpg'
22 'image/png': 'png'
3 'image/svg+xml': 'svg'
34
45 'video/webm': 'webm'
56 'video/mp4': 'mp4'
1516 out: 'URL -> %1',
1617 cost: 5
1718 transform: (val, fileder, key) =>
18 escaped_from = @from\gsub '/', '$'
19 escaped_from = @from\gsub '/', '_'
1920 if ext = extensions[@from]
2021 escaped_from ..= ".#{ext}"
2122
22 with url = "#{fileder.path}/#{key.name}:#{escaped_from}"
23 prefix = STATIC.root or ''
24
25 prefix .. with url = "#{fileder.path}/#{key.name}:#{escaped_from}"
2326 print " rendering asset #{url}"
2427 STATIC.spit url, val
2528 }
55 attr[k] = v
66
77 tourl = (path) ->
8 if STATIC
9 path .. '/'
10 else
11 path .. '/'
8 path ..= '/'
9 if STATIC and STATIC.root
10 path = STATIC.root .. path
11 path
1212
1313 (elements) ->
1414 import a, div, span, sup, b, pre from elements
9999 }
100100 }
101101
102 pre, code {
103 text-align: initial;
104 }
105
102106 pre > code {
103107 @include left-border;
104108 border-color: $gray-dark;