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
36
.justfile
36
.justfile
|
|
@ -3,10 +3,6 @@ mod repo ".devfiles/justfile"
|
|||
|
||||
set dotenv-load := true
|
||||
|
||||
set shell := ["zsh", "-uc"]
|
||||
|
||||
build_mode := env("BUILD_MODE", "DEVELOPMENT")
|
||||
|
||||
[private]
|
||||
docker-compose +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")
|
||||
|
||||
dev:
|
||||
watchexec --restart --clear --watch src --watch templates cargo run
|
||||
watchexec --restart --clear --watch src --watch dist cargo run
|
||||
|
||||
migrate: (docker-compose "run dbmate migrate")
|
||||
|
|
@ -22,13 +17,24 @@ migrate: (docker-compose "run dbmate migrate")
|
|||
rollback: (docker-compose "run dbmate rollback")
|
||||
|
||||
build-frontend:
|
||||
bun build \
|
||||
{{ if uppercase(build_mode) == "DEVELOPMENT" { "--watch" } else { "" } }} \
|
||||
--outdir 'dist' \
|
||||
--public-path '/' \
|
||||
--entry-naming '[dir]/[name].[ext]' \
|
||||
--chunk-naming 'assets/[name]-[hash].[ext]' \
|
||||
--asset-naming 'assets/[name]-[hash].[ext]' \
|
||||
--splitting \
|
||||
--css-chunking \
|
||||
{{ './frontend/**/*.html' }}
|
||||
#!/usr/bin/env bun
|
||||
import sassPlugin from "@alecodes/bun-plugin-sass";
|
||||
|
||||
const entrypoints = Array.from(
|
||||
new Bun.Glob("frontend/**/*.html").scanSync(".")
|
||||
);
|
||||
|
||||
const result = await Bun.build({
|
||||
entrypoints,
|
||||
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!");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue