aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-11-23 02:56:23 +0000
committers-ol <s-ol@users.noreply.github.com>2018-11-23 02:56:23 +0000
commite86946428223bbcaae089bb92066988c3af129a0 (patch)
treee079fe1fb1e66c2d6bc1a489e8bcec7703376482
parentremove deploy.sh, doesn't work with stuff (diff)
downloadmmm-e86946428223bbcaae089bb92066988c3af129a0.tar.gz
mmm-e86946428223bbcaae089bb92066988c3af129a0.zip
clean-ish header
-rw-r--r--build/render_fileder.moon67
-rw-r--r--mmm/mmmfs/init.moon22
-rw-r--r--scss/browser.scss2
-rw-r--r--scss/main.scss36
4 files changed, 98 insertions, 29 deletions
diff --git a/build/render_fileder.moon b/build/render_fileder.moon
index d76d162..f8958aa 100644
--- a/build/render_fileder.moon
+++ b/build/render_fileder.moon
@@ -1,20 +1,47 @@
require 'mmm'
-import render from require 'mmm.mmmfs'
import get_path from require 'build.util'
+import tohtml from require 'mmm.component'
+import Browser from require 'mmm.mmmfs.browser'
+
+export BROWSER
-- usage:
-- moon render.moon <path_to_root>
{ path_to_root } = arg
+seed = (str) ->
+ len = #str
+ rnd = -> math.ceil math.random! * len
+
+ math.randomseed len
+
+ return if len == 0
+
+ upper, lower = 0, 0
+ for i=1,4
+ upper += str\byte rnd!
+ upper *= 0x100
+
+ lower += str\byte rnd!
+ lower *= 0x100
+
+ math.randomseed upper, lower
+
+pick = (...) ->
+ num = select '#', ...
+ i = math.ceil math.random! * num
+ select i, ...
+
assert path_to_root, "please specify the relative root path"
path = get_path path_to_root
+seed path
+
root = dofile '$bundle.lua'
assert root, "couldn't load $bundle.lua"
root\mount path, true
-content, rehydrate = render root, path
-assert content, "no content"
+BROWSER = Browser root, path
with io.open 'index.html', 'w'
\write "<!DOCTYPE html>
@@ -30,9 +57,29 @@ with io.open 'index.html', 'w'
<link rel=\"preload\" as=\"fetch\" href=\"/mmm/mmmfs/fileder.lua\" />
<link rel=\"preload\" as=\"fetch\" href=\"/mmm/mmmfs/browser.lua\" />
-->
+
+ <link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400\" rel=\"stylesheet\">
</head>
<body>
- #{content}
+ <header>
+ <h1>
+ <i class=\"sun\">☉</i>
+ <b></b>
+ <span class=\"bold\">mmm</span>
+ .s-ol.nu
+ </h1>
+ <span>
+ fun stuff with code and wires
+<!--
+ #{pick 'fun', 'cool', 'weird', 'interesting', 'new'}
+ #{pick 'stuff', 'things', 'projects', 'experiments', 'news'}
+ with
+ #{pick 'mostly code', 'code and wires', 'silicon', 'electronics'}
+-->
+ </span>
+ </header>
+
+ #{assert (tohtml BROWSER), "couldn't render BROWSER"}
<script src=\"/highlight.pack.js\"></script>
<script src=\"//cdnjs.cloudflare.com/ajax/libs/marked/0.5.1/marked.min.js\"></script>
@@ -41,7 +88,17 @@ with io.open 'index.html', 'w'
<script type=\"application/lua\" src=\"/mmm.bundle.lua\"></script>
<script type=\"application/lua\">require 'mmm'</script>
- #{rehydrate}
+ <script type=\"application/lua\">
+ on_load = on_load or {}
+ table.insert(on_load, function()
+ local path = #{string.format '%q', path}
+ local browser = require 'mmm.mmmfs.browser'
+ local root = dofile '/$bundle.lua'
+ root:mount('', true)
+
+ BROWSER = browser.Browser(root, path, true)
+ end)
+ </script>
</body>
</html>"
\close!
diff --git a/mmm/mmmfs/init.moon b/mmm/mmmfs/init.moon
index 4dd5c32..8aba86a 100644
--- a/mmm/mmmfs/init.moon
+++ b/mmm/mmmfs/init.moon
@@ -1,31 +1,9 @@
require = relative ...
import Key, Fileder from require '.fileder'
import Browser from require '.browser'
-import tohtml from require 'mmm.component'
-
-render = (root, path) ->
- export BROWSER
- BROWSER = Browser root, path
-
- content = tohtml BROWSER
-
- rehydrate = "
-<script type=\"application/lua\">
- on_load = on_load or {}
- table.insert(on_load, function()
- local path = #{string.format '%q', path}
- local browser = require 'mmm.mmmfs.browser'
- local root = dofile '/$bundle.lua'
- root:mount('', true)
-
- BROWSER = browser.Browser(root, path, true)
- end)
-</script>"
- content, rehydrate
{
:Key
:Fileder
:Browser
- :render
}
diff --git a/scss/browser.scss b/scss/browser.scss
index ab03d59..1117da7 100644
--- a/scss/browser.scss
+++ b/scss/browser.scss
@@ -46,7 +46,7 @@
display: flex;
flex: 0 0 3.2em;
justify-content: space-between;
- background: #eeeeee;
+ background: $gray-bright;
/*
> * {
diff --git a/scss/main.scss b/scss/main.scss
index 070eac0..adbb65d 100644
--- a/scss/main.scss
+++ b/scss/main.scss
@@ -36,6 +36,40 @@ a {
color: inherit;
}
+header {
+ font-family: 'Source Sans Pro', sans-serif;
+ padding: 1rem 2rem;
+ text-align: right;
+
+ color: $gray-bright;
+ background: $gray-dark;
+
+ h1 {
+ display: flex;
+ justify-content: space-around;
+ align-items: baseline;
+ margin: 0;
+
+ font-size: 4rem;
+ font-weight: 200;
+
+ > b {
+ flex: 1;
+ }
+
+ .bold {
+ font-weight: 400;
+ }
+ }
+
+ i.sun {
+ font-style: normal;
+ font-weight: 800;
+ font-size: 0.7em;
+ vertical-align: -0.04em;
+ }
+}
+
.canvas_app {
position: relative;
@@ -67,7 +101,7 @@ a {
a {
display: block;
- color: #eee;
+ color: $gray-bright;
font-family: inherit;
}
}