This commit is contained in:
SouthFox 2023-08-18 17:02:12 +08:00
commit 255445d31f
10 changed files with 3765 additions and 0 deletions

22
.gitignore vendored Normal file
View file

@ -0,0 +1,22 @@
node_modules/
public/js
/target
/checkouts
/src/gen
pom.xml
pom.xml.asc
*.iml
*.jar
*.log
.shadow-cljs
.idea
.lein-*
.nrepl-*
.clj-kondo
.lsp
.DS_Store
.hgignore
.hg/

5
.projectile Normal file
View file

@ -0,0 +1,5 @@
- /node_modules
- /public/js
- /.clj-kondo
- /.shadow-cljs
- /.lsp

3636
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

26
package.json Normal file
View file

@ -0,0 +1,26 @@
{
"scripts": {
"shadow:watch": "shadow-cljs watch app",
"shadow:release": "shadow-cljs release app",
"postcss:build": "postcss src/css/tailwind.css -o ./public/css/app.css --verbose",
"postcss:watch": "postcss src/css/tailwind.css -o ./public/css/app.css --verbose -w",
"postcss:release": "cross-env NODE_ENV=production postcss src/css/tailwind.css -o ./public/css/app.css --verbose",
"dev": "run-p -l *:watch",
"release": "run-s *:release"
},
"name": "liberty-hu",
"version": "0.0.1",
"private": true,
"devDependencies": {
"autoprefixer": "^10.4.15",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.28",
"postcss-cli": "^10.1.0",
"postcss-import": "^15.1.0",
"shadow-cljs": "2.25.2",
"tailwindcss": "^3.3.3"
},
"dependencies": {
"react-dom": "^18.2.0"
}
}

9
postcss.config.js Normal file
View file

@ -0,0 +1,9 @@
// postcss.config.js
module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('autoprefixer'),
// process.env.NODE_ENV === 'production' ? require('cssnano') : '',
]
}

15
public/index.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browser Starter</title>
<link rel="stylesheet" href="./css/app.css" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="app" classs="bg-gray-900"></div>
<script src="/js/main.js"></script>
</body>
</html>

14
shadow-cljs.edn Normal file
View file

@ -0,0 +1,14 @@
;; shadow-cljs configuration
{:source-paths
["src/dev"
"src/main"
"src/test"]
:dependencies
[[reagent "1.2.0"]]
:dev-http {8080 "public"}
:builds
{:frontend
{:target :browser
:modules {:main {:init-fn frontend.app/init}}}}}

8
src/css/tailwind.css Normal file
View file

@ -0,0 +1,8 @@
/* Reset */
@import 'tailwindcss/base';
/* Components */
@import 'tailwindcss/components';
/* Utilities */
@import 'tailwindcss/utilities';

View file

@ -0,0 +1,21 @@
(ns frontend.app
(:require [reagent.dom.client :as r]))
(defn hello-world []
[:div
[:div.hover:bg-gray-100 [:p.text-blue-500 "aaaaaa"]]
[:li "World!"]])
(defonce root (r/create-root (js/document.getElementById "app")))
(defn ^:dev/after-load start []
(r/render root [hello-world] ))
(defn init []
;; this is called in the index.html and must be exported
;; so it is available even in :advanced release builds
(js/console.log "init")
(start))
(defn ^:dev/before-load stop []
(js/console.log "stop"))

9
tailwind.config.js Normal file
View file

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/main/frontend/*.cljs'],
theme: {
extend: {},
},
plugins: [],
}