From 270f592fc65cd5553ccf7c0dc81431c3efdf67ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Fri, 3 Oct 2025 17:21:29 +0200 Subject: feat(frontend): bundle htmx and set every external link to target blank --- backend/templates/base.html | 3 ++- bun.lock | 3 +++ frontend/scss/home.scss | 2 +- index.ts | 7 ++++++- package.json | 1 + tsconfig.json | 4 ++-- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/templates/base.html b/backend/templates/base.html index 8466bc0..68d3f8d 100644 --- a/backend/templates/base.html +++ b/backend/templates/base.html @@ -39,7 +39,8 @@ + diff --git a/bun.lock b/bun.lock index 3269829..1fbf6c2 100644 --- a/bun.lock +++ b/bun.lock @@ -4,6 +4,7 @@ "": { "name": "small-web", "dependencies": { + "htmx.org": "2.0.7", "reset-css": "^5.0.2", "sass": "^1.93.2", "scss": "^0.2.4", @@ -63,6 +64,8 @@ "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], + "htmx.org": ["htmx.org@2.0.7", "", {}, "sha512-YiJqF3U5KyO28VC5mPfehKJPF+n1Gni+cupK+D69TF0nm7wY6AXn3a4mPWIikfAXtl1u1F1+ZhSCS7KT8pVmqA=="], + "immutable": ["immutable@5.1.3", "", {}, "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg=="], "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], diff --git a/frontend/scss/home.scss b/frontend/scss/home.scss index 29a0116..0b85b2b 100644 --- a/frontend/scss/home.scss +++ b/frontend/scss/home.scss @@ -23,7 +23,7 @@ article article { align-content: center; gap: var(--margin-base); - @media only screen and (max-width: 350px) { + @media only screen and (max-width: 400px) { display: flex; flex-direction: column-reverse; } diff --git a/index.ts b/index.ts index f67b2c6..72679ce 100644 --- a/index.ts +++ b/index.ts @@ -1 +1,6 @@ -console.log("Hello via Bun!"); \ No newline at end of file +import 'htmx.org'; + +document.querySelectorAll("a").forEach(e => { + if (e.href.startsWith(window.location.origin)) return; + e.target = "_blank"; +}); diff --git a/package.json b/package.json index 1cf5eb4..543b5bf 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "typescript": "^5" }, "dependencies": { + "htmx.org": "2.0.7", "reset-css": "^5.0.2", "sass": "^1.93.2", "scss": "^0.2.4" diff --git a/tsconfig.json b/tsconfig.json index bfa0fea..56d55cc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", + "lib": ["ESNext", "DOM"], + "target": "ES2018", "module": "Preserve", "moduleDetection": "force", "jsx": "react-jsx", -- cgit v1.2.3