Refactor web frontend and remove unnecessary dependencies.
- Eliminate frontend JS build step completely: (remove dep: NodeJS, npx, tailwind, postcss, autoprefixer) - Declutter and cleanup index.html (8.49 KB to 3.4 KB) = ~60% savings. - Replace tailwind with custom CSS (10.64 KB to 1.96 KB) = ~81% savings. - Remove Google font (~100 KB) as there is very little text on the page. - Refactor and cleanup main.js and remove tailwind styling logic. (2.82 KB to 1.12 KB) = ~60% savings. - Net static asset reduction = 21.95 KB to 6.48 KB = ~70% savings apart from the 100+ KB elimination of Google fonts.
This commit is contained in:
parent
0dc61ac8ec
commit
b8ba782cf3
5 changed files with 337 additions and 1435 deletions
10
Makefile
10
Makefile
|
@ -9,18 +9,10 @@ VERSION := ${HASH}
|
|||
build-cli:
|
||||
go build -o ${CLI_BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" ./cmd/doggo/cli/
|
||||
|
||||
.PHONY: build-frontend
|
||||
build-frontend:
|
||||
cd cmd/doggo/api && NODE_ENV=production npx tailwindcss build -o ./assets/tailwind.css
|
||||
|
||||
.PHONY: build-api
|
||||
build-api:
|
||||
go build -o ${API_BIN} -ldflags="-X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'" ./cmd/doggo/api/
|
||||
|
||||
.PHONY: deps
|
||||
deps:
|
||||
cd cmd/doggo/api && npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
|
||||
|
||||
.PHONY: build
|
||||
build: build-api build-cli
|
||||
|
||||
|
@ -29,7 +21,7 @@ run-cli: build-cli ## Build and Execute the CLI binary after the build step.
|
|||
${CLI_BIN}
|
||||
|
||||
.PHONY: run-api
|
||||
run-api: build-frontend build-api ## Build and Execute the API binary after the build step.
|
||||
run-api: build-api ## Build and Execute the API binary after the build step.
|
||||
${API_BIN} --config config-api-sample.toml
|
||||
|
||||
.PHONY: clean
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue