Skip to content

Commit

Permalink
[refactor] happyx
Browse files Browse the repository at this point in the history
  • Loading branch information
Keisuke Izumiya committed Jan 3, 2024
1 parent 0ffcb6a commit f46f1c1
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
!/benchmark/*.nim*

# HappyX
/src/assets/
/src/pon2.js
/www-happyx/
/happyx/assets/
/happyx/build/
/happyx/main.js
6 changes: 3 additions & 3 deletions happyx.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Main]
projectName = pon2
projectType = SPA
mainFile = pon2
srcDir = src
buildDir = www-happyx
mainFile = main
srcDir = happyx
buildDir = happyx/build
assetsDir = assets
language = nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{.experimental: "strictDefs".}
{.experimental: "strictFuncs".}
{.experimental: "views".}

import happyx

component Hello:
Expand Down
2 changes: 2 additions & 0 deletions happyx/config.nims
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--define: ssl
--define: useMalloc # only needed at Nim-v2.0.2
8 changes: 4 additions & 4 deletions src/index.html → happyx/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
touch-action: manipulation;
}
</style>
<link href='./public/fontawesome/css/fontawesome.min.css' rel='stylesheet'>
<link href='./public/fontawesome/css/brands.min.css' rel='stylesheet'>
<link href='./public/fontawesome/css/solid.min.css' rel='stylesheet'>
<link href='./assets/fontawesome/css/fontawesome.min.css' rel='stylesheet'>
<link href='./assets/fontawesome/css/brands.min.css' rel='stylesheet'>
<link href='./assets/fontawesome/css/solid.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css' rel='stylesheet'>
</head>

<body>
<div id='pon2'></div>
<script src='./pon2.js'></script>
<script src='./main.js'></script>
<script src='https://html2canvas.hertzen.com/dist/html2canvas.min.js'></script>
</body>

Expand Down
10 changes: 10 additions & 0 deletions happyx/main.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{.experimental: "strictDefs".}
{.experimental: "strictFuncs".}
{.experimental: "views".}

import happyx
import ./components/[hello]

appRoutes "pon2":
"/":
component Hello
10 changes: 2 additions & 8 deletions pon2.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,5 @@ task web, "Make Web Page":
exec "cp -r assets www"

task happyx, "HappyX":
cpDir "assets", "src/assets"
try:
exec "hpx build"
except OSError:
cpFile "src/index.html", "www-happyx/index.html"
cpFile "src/pon2.js", "www-happyx/pon2.js"
cpDir "src/assets", "www-happyx/public"
rmDir "www-happyx/assets"
cpDir "assets", "happyx/assets"
exec "hpx build"
3 changes: 2 additions & 1 deletion src/config.nims
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--define:ssl
--define: ssl
--define: useMalloc # only needed at Nim-v2.0.2
9 changes: 0 additions & 9 deletions src/pon2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@

{.experimental: "strictDefs".}

#[
import happyx
import ./pon2pkg/private/simulator/components/[hello]
appRoutes "pon2":
"/":
component Hello
]#

when defined(js):
import std/[options, sequtils, uri]
import karax/[karax, karaxdsl, vdom]
Expand Down

0 comments on commit f46f1c1

Please sign in to comment.