Bundle js modules with vite

This commit is contained in:
Akira Tempaku 2024-02-22 02:20:00 +09:00
parent 138c163a6d
commit d8db79e00c
12 changed files with 943 additions and 44 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
node_modules
static/style/tailwind.css
.vscode/alive
dist

View file

@ -1,8 +1,8 @@
install: ## Install dependencies
@qlot install ; npm i
css: ## Scan and build tailwindcss
@npx tailwindcss -o ./static/style/tailwind.css --watch
dev: ## Run dev mode
@npm run dev
help: ## Show options
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \

922
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,22 @@
{
"name": "hp",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"daisyui": "^4.6.1",
"tailwindcss": "^3.4.1"
"autoprefixer": "^10.4.17",
"daisyui": "^4.7.2",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1",
"vite": "^5.1.4"
},
"dependencies": {
"alpinejs": "^3.13.5",
"htmx.org": "^1.9.10"
}
}

6
postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View file

@ -19,8 +19,8 @@
(defparameter *app*
(lack:builder (:static
:path "/static/"
:root (asdf:system-relative-pathname :hp "static/"))
:path "/dist/assets/"
:root (asdf:system-relative-pathname :hp "assets/"))
*raw-app*))
; for clackup cmd

View file

@ -9,10 +9,8 @@
(html
(head
(title "skyizwhite.dev")
(script :src "/static/vendor/htmx.min.js")
(script :defer t :src "/static/vendor/alpine.min.js")
(link :href "/static/style/main.css" :rel "stylesheet")
(link :href "/static/style/tailwind.css" :rel "stylesheet"))
(script :type "module" :src "http://localhost:5173/@vite/client")
(script :type "module" :src "http://localhost:5173/src/js/main.js"))
(body :class "h-[100svh] w-screen"
(main :class "h-full"
pi:children)))))

8
src/js/main.js Normal file
View file

@ -0,0 +1,8 @@
import './style.css'
import HTMX from 'htmx.org'
import Alpine from 'alpinejs'
window.htmx = HTMX;
window.Alpine = Alpine
Alpine.start()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10
vite.config.js Normal file
View file

@ -0,0 +1,10 @@
import { defineConfig } from 'vite'
export default defineConfig({
build: {
manifest: true,
rollupOptions: {
input: 'src/js/main.js',
},
},
})