generated from alecodes/base-template
revert: refactor: build fronend via cli to allow watch mode
this revert e0e8700baa, the build via cli doesn't support plugins
This commit is contained in:
parent
48afdaccea
commit
cfaf7ecc1f
5 changed files with 22 additions and 42 deletions
|
|
@ -1,3 +0,0 @@
|
||||||
import sassPlugin from "@alecodes/bun-plugin-sass";
|
|
||||||
|
|
||||||
Bun.plugin(sassPlugin);
|
|
||||||
36
.justfile
36
.justfile
|
|
@ -3,10 +3,6 @@ mod repo ".devfiles/justfile"
|
||||||
|
|
||||||
set dotenv-load := true
|
set dotenv-load := true
|
||||||
|
|
||||||
set shell := ["zsh", "-uc"]
|
|
||||||
|
|
||||||
build_mode := env("BUILD_MODE", "DEVELOPMENT")
|
|
||||||
|
|
||||||
[private]
|
[private]
|
||||||
docker-compose +ARGS:
|
docker-compose +ARGS:
|
||||||
docker compose --file .devfiles/docker/docker-compose.dev.yaml --env-file .env --project-name compendium {{ARGS}}
|
docker compose --file .devfiles/docker/docker-compose.dev.yaml --env-file .env --project-name compendium {{ARGS}}
|
||||||
|
|
@ -14,7 +10,6 @@ docker-compose +ARGS:
|
||||||
start-dev-services: (docker-compose "up --remove-orphans")
|
start-dev-services: (docker-compose "up --remove-orphans")
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
watchexec --restart --clear --watch src --watch templates cargo run
|
|
||||||
watchexec --restart --clear --watch src --watch dist cargo run
|
watchexec --restart --clear --watch src --watch dist cargo run
|
||||||
|
|
||||||
migrate: (docker-compose "run dbmate migrate")
|
migrate: (docker-compose "run dbmate migrate")
|
||||||
|
|
@ -22,13 +17,24 @@ migrate: (docker-compose "run dbmate migrate")
|
||||||
rollback: (docker-compose "run dbmate rollback")
|
rollback: (docker-compose "run dbmate rollback")
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
bun build \
|
#!/usr/bin/env bun
|
||||||
{{ if uppercase(build_mode) == "DEVELOPMENT" { "--watch" } else { "" } }} \
|
import sassPlugin from "@alecodes/bun-plugin-sass";
|
||||||
--outdir 'dist' \
|
|
||||||
--public-path '/' \
|
const entrypoints = Array.from(
|
||||||
--entry-naming '[dir]/[name].[ext]' \
|
new Bun.Glob("frontend/**/*.html").scanSync(".")
|
||||||
--chunk-naming 'assets/[name]-[hash].[ext]' \
|
);
|
||||||
--asset-naming 'assets/[name]-[hash].[ext]' \
|
|
||||||
--splitting \
|
const result = await Bun.build({
|
||||||
--css-chunking \
|
entrypoints,
|
||||||
{{ './frontend/**/*.html' }}
|
outdir: "dist",
|
||||||
|
publicPath: "/",
|
||||||
|
splitting: true,
|
||||||
|
plugins: [sassPlugin],
|
||||||
|
naming: {
|
||||||
|
entry: "[dir]/[name].[ext]",
|
||||||
|
chunk: "assets/[name]-[hash].[ext]",
|
||||||
|
asset: "assets/[name]-[hash].[ext]",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Assets compiled!");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
preload = ["./.devfiles/init-bun.ts"]
|
|
||||||
|
|
||||||
[serve.static]
|
[serve.static]
|
||||||
plugins = ["bun-plugin-sass"]
|
plugins = ["bun-plugin-sass"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
h1 {
|
h1 {
|
||||||
color: blue;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link rel="stylesheet" href="../css/style.css" />
|
|
||||||
<title>
|
|
||||||
{% block title %}Axum web service!{% endblock %}
|
|
||||||
</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
{% include "partials/header.html" %}
|
|
||||||
<main>
|
|
||||||
<nav class="msp-d-sm-none msp-d-flex msp-justify-content-end">
|
|
||||||
<button class="msp-offcanvas-toggle" data-msp-target="#main-offcanvas">Toggle</button>
|
|
||||||
</nav>
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue