🌐 pmme-ui: Shadow-cljs configured for hot reloading, moved static files to ui side
This commit is contained in:
parent
6892060d16
commit
2c741adac7
1
pmme-mobile/.gitignore
vendored
1
pmme-mobile/.gitignore
vendored
@ -23,3 +23,4 @@ dist-ssr
|
|||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
*.jks
|
*.jks
|
||||||
|
src/
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "com.pmme.app",
|
"identifier": "com.pmme.app",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../src"
|
"devUrl": "http://localhost:3000"
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="stylesheet" href="styles.css" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Tauri App</title>
|
|
||||||
<script type="module" src="./js/main.js" defer></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<main class="container">
|
|
||||||
<h1>Welcome to Tauri</h1>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<a href="https://tauri.app" target="_blank">
|
|
||||||
<img src="/assets/tauri.svg" class="logo tauri" alt="Tauri logo" />
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="/assets/javascript.svg"
|
|
||||||
class="logo vanilla"
|
|
||||||
alt="JavaScript logo"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<p>Click on the Tauri logo to learn more about the framework</p>
|
|
||||||
|
|
||||||
<form class="row" id="greet-form">
|
|
||||||
<input id="greet-input" placeholder="Enter a name..." />
|
|
||||||
<button type="submit">Greet</button>
|
|
||||||
</form>
|
|
||||||
<p id="greet-msg"></p>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,18 +0,0 @@
|
|||||||
const { invoke } = window.__TAURI__.core;
|
|
||||||
|
|
||||||
let greetInputEl;
|
|
||||||
let greetMsgEl;
|
|
||||||
|
|
||||||
async function greet() {
|
|
||||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
|
||||||
greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value });
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
|
||||||
greetInputEl = document.querySelector("#greet-input");
|
|
||||||
greetMsgEl = document.querySelector("#greet-msg");
|
|
||||||
document.querySelector("#greet-form").addEventListener("submit", (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
greet();
|
|
||||||
});
|
|
||||||
});
|
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
@ -1,12 +1,32 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<link rel="stylesheet" href="/styles.css" />
|
||||||
<title>PMME UI</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri App</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<main class="container">
|
||||||
<script src="/js/main.js"></script>
|
<h1>Welcome to Tauri</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a href="https://tauri.app" target="_blank">
|
||||||
|
<img src="/assets/tauri.svg" class="logo tauri" alt="Tauri logo" />
|
||||||
|
</a>
|
||||||
|
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
|
||||||
|
<img src="/assets/javascript.svg" class="logo vanilla" alt="JavaScript logo" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<p>Click on the Tauri logo to learn more about the framework.</p>
|
||||||
|
|
||||||
|
<form class="row" id="greet-form">
|
||||||
|
<input id="greet-input" placeholder="Enter a name..." />
|
||||||
|
<button type="submit">Greet</button>
|
||||||
|
</form>
|
||||||
|
<p id="greet-msg"></p>
|
||||||
|
</main>
|
||||||
|
<script src="./js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -6,14 +6,21 @@
|
|||||||
:dependencies
|
:dependencies
|
||||||
[]
|
[]
|
||||||
|
|
||||||
|
:dev-http {3000 "public"}
|
||||||
|
|
||||||
:builds
|
:builds
|
||||||
{:app {:target :browser
|
{:app {:target :browser
|
||||||
:output-dir "public/js"
|
:output-dir "public/js"
|
||||||
:asset-path "/js"
|
:asset-path "/js"
|
||||||
:modules {:main {:init-fn pmme-ui.core/init}}}
|
:modules {:main {:init-fn pmme-ui.core/init}}
|
||||||
|
:devtools {:devtools-url "http://192.168.110.133:9630"}}
|
||||||
|
|
||||||
:release {:target :browser
|
:release {:target :browser
|
||||||
:output-dir "../pmme-mobile/src/js"
|
:output-dir "../pmme-mobile/src/js"
|
||||||
:asset-path "/js"
|
:asset-path "/js"
|
||||||
:modules {:main {:init-fn pmme-ui.core/init}}
|
:modules {:main {:init-fn pmme-ui.core/init}}
|
||||||
:compiler-options {:optimizations :advanced}}}}
|
:compiler-options {:optimizations :advanced}
|
||||||
|
:build-hooks [(shadow.resource/copy-resources
|
||||||
|
{:from "public"
|
||||||
|
:to "../pmme-mobile/src"
|
||||||
|
:exclude ["**/*.js"]})]}}}
|
||||||
|
@ -10,13 +10,17 @@
|
|||||||
(set! (.-innerHTML msg-element) "Please enter a name!")
|
(set! (.-innerHTML msg-element) "Please enter a name!")
|
||||||
(do
|
(do
|
||||||
;; You could call a Tauri command here instead
|
;; You could call a Tauri command here instead
|
||||||
|
(js/console.log "Testing the chrome thingie")
|
||||||
(set! (.-innerHTML msg-element)
|
(set! (.-innerHTML msg-element)
|
||||||
(str "Hello, " name "! 👋 (from ClojureScript)"))
|
(str "Hello, " name "! 👋 (from ClojureScript)!"))
|
||||||
(set! (.-value input) "")))))
|
(set! (.-value input) "")))))
|
||||||
|
|
||||||
|
(defn greet-handler [event]
|
||||||
|
(handle-greet event))
|
||||||
|
|
||||||
(defn setup-greet-form []
|
(defn setup-greet-form []
|
||||||
(when-let [form (.getElementById js/document "greet-form")]
|
(when-let [form (.getElementById js/document "greet-form")]
|
||||||
(.addEventListener form "submit" handle-greet)))
|
(.addEventListener form "submit" greet-handler)))
|
||||||
|
|
||||||
(defn add-dynamic-styling []
|
(defn add-dynamic-styling []
|
||||||
(let [style (.createElement js/document "style")]
|
(let [style (.createElement js/document "style")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user