aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2018-05-02 13:08:55 +0000
committers-ol <s-ol@users.noreply.github.com>2018-05-02 13:10:52 +0000
commite0e3c47ff1c282316dd8ff526ea934c6d69a3719 (patch)
treede81888aeabdc84df61dbc77f60cdf4e2194543a
parentinitial commit (diff)
downloadmmm-e0e3c47ff1c282316dd8ff526ea934c6d69a3719.tar.gz
mmm-e0e3c47ff1c282316dd8ff526ea934c6d69a3719.zip
add index
-rw-r--r--app/html.moon2
-rw-r--r--app/index.moon38
-rw-r--r--webpack.config.js2
3 files changed, 40 insertions, 2 deletions
diff --git a/app/html.moon b/app/html.moon
index b89344c..cf4a6e6 100644
--- a/app/html.moon
+++ b/app/html.moon
@@ -16,7 +16,7 @@ element = (element) -> (attrs = {}, ...) ->
elements = {}
add = (e) -> elements[e] = element e
-for e in *{'div', 'span', 'a', 'p', 'button', 'ul', 'li'} do add e
+for e in *{'div', 'span', 'a', 'p', 'button', 'ul', 'li', 'i', 'b', 'u', 'tt'} do add e
for e in *{'br', 'img', 'input', 'p'} do add e
for i=1,8 do add "h" .. i
diff --git a/app/index.moon b/app/index.moon
new file mode 100644
index 0000000..b501d57
--- /dev/null
+++ b/app/index.moon
@@ -0,0 +1,38 @@
+window = js.global
+document = window.document
+
+import h1, p, a, br, ul, tt, li from require './html.moon'
+
+moon = '\xe2\x98\xbd'
+back_button = ->
+ document.body\appendChild p a { '< back', href: '/' }
+
+switch window.location.search
+ when "?twisted"
+ back_button!
+ require './twisted.moon'
+ when "?center-of-mass" then
+ back_button!
+ require './centerofmass.moon'
+ else
+ document.body\appendChild h1 'mmm'
+ document.body\appendChild p {
+ tt 'mmm'
+ ' is not the '
+ tt 'www'
+ ', because it runs on '
+ a { 'MoonScript', href: 'https://moonscript.org' }
+ '.'
+ br!
+ 'You can find the source code of everything '
+ a { 'here', href: 'https://github.com/s-ol/mmm' }
+ '.'
+ }
+ document.body\appendChild p 'current demos:'
+ document.body\appendChild ul for name in *{'twisted', 'center-of-mass'}
+ li a { name, href: "/?#{name}" }
+
+document.body\appendChild p {
+ "made with #{moon} by "
+ a { 's-ol', href: 'https://twitter.com/S0lll0s' }
+}
diff --git a/webpack.config.js b/webpack.config.js
index 092890a..c5d22c3 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -3,7 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, 'app'),
- entry: './centerbyweight.moon',
+ entry: './index.moon',
mode: 'development',
module: {
rules: [