diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-01-30 13:29:39 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-01 15:19:08 +0000 |
| commit | 4e87b58bad3879633e4db3c93a152cf6f777784b (patch) | |
| tree | b8148c48c2044197af057ab758cdefb11547dae6 | |
| parent | fix static rendering (diff) | |
| download | mmm-4e87b58bad3879633e4db3c93a152cf6f777784b.tar.gz mmm-4e87b58bad3879633e4db3c93a152cf6f777784b.zip | |
static rendering root prefix
| -rw-r--r-- | build/render_all.moon | 6 | ||||
| -rw-r--r-- | mmm/mmmfs/layout.moon | 2 | ||||
| -rw-r--r-- | mmm/mmmfs/plugins/static.moon | 7 | ||||
| -rw-r--r-- | mmm/mmmfs/util.moon | 8 | ||||
| -rw-r--r-- | scss/_content.scss | 4 |
5 files changed, 18 insertions, 9 deletions
diff --git a/build/render_all.moon b/build/render_all.moon index 57406be..1135d27 100644 --- a/build/render_all.moon +++ b/build/render_all.moon @@ -8,8 +8,8 @@ add '?/init' add '?/init.server' -- usage: --- moon render_all.moon [STORE] [output] [startpath] -{ store, output, startpath } = arg +-- moon render_all.moon [STORE] [output] [URL-prefix] +{ store, output, prefix } = arg require 'mmm' import Fileder, dir_base from require 'mmm.mmmfs.fileder' @@ -25,6 +25,8 @@ STATIC = { with io.open path, 'w' \write val \close! + + root: prefix } require 'mmm.mmmfs' diff --git a/mmm/mmmfs/layout.moon b/mmm/mmmfs/layout.moon index 3694ddd..861f8e0 100644 --- a/mmm/mmmfs/layout.moon +++ b/mmm/mmmfs/layout.moon @@ -130,7 +130,7 @@ render = (content, fileder, opts={}) -> <!DOCTYPE html> <html> <head>]] - buf ..= STATIC.style or [[<link rel="stylesheet" type="text/css" href="/static/style/:text/css" />]] + buf ..= if STATIC then STATIC.style else [[<link rel="stylesheet" type="text/css" href="/static/style/:text/css" />]] buf ..= [[<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,600" />]] buf ..= " #{get_meta fileder} diff --git a/mmm/mmmfs/plugins/static.moon b/mmm/mmmfs/plugins/static.moon index 6ba27fe..d65b822 100644 --- a/mmm/mmmfs/plugins/static.moon +++ b/mmm/mmmfs/plugins/static.moon @@ -1,6 +1,7 @@ extensions = { 'image/jpeg': 'jpg' 'image/png': 'png' + 'image/svg+xml': 'svg' 'video/webm': 'webm' 'video/mp4': 'mp4' @@ -16,11 +17,13 @@ extensions = { out: 'URL -> %1', cost: 5 transform: (val, fileder, key) => - escaped_from = @from\gsub '/', '$' + escaped_from = @from\gsub '/', '_' if ext = extensions[@from] escaped_from ..= ".#{ext}" - with url = "#{fileder.path}/#{key.name}:#{escaped_from}" + prefix = STATIC.root or '' + + prefix .. with url = "#{fileder.path}/#{key.name}:#{escaped_from}" print " rendering asset #{url}" STATIC.spit url, val } diff --git a/mmm/mmmfs/util.moon b/mmm/mmmfs/util.moon index 8403438..5e99ebd 100644 --- a/mmm/mmmfs/util.moon +++ b/mmm/mmmfs/util.moon @@ -6,10 +6,10 @@ merge = (orig={}, extra={}) -> attr[k] = v tourl = (path) -> - if STATIC - path .. '/' - else - path .. '/' + path ..= '/' + if STATIC and STATIC.root + path = STATIC.root .. path + path (elements) -> import a, div, span, sup, b, pre from elements diff --git a/scss/_content.scss b/scss/_content.scss index 87f515d..f9a00dc 100644 --- a/scss/_content.scss +++ b/scss/_content.scss @@ -100,6 +100,10 @@ } } + pre, code { + text-align: initial; + } + pre > code { @include left-border; border-color: $gray-dark; |
