From f7d8feac5d713950dbcc84583d3bd850106973a6 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 23 Jan 2021 18:53:14 +0000 Subject: [PATCH] bundle css with esbuild --- .goreleaser.yml | 4 ++-- Makefile | 14 ++++++++------ css/base.css | 10 +++++----- html/404.html | 2 +- html/admin.html | 2 +- html/form.html | 2 +- html/invalidCode.html | 2 +- test.css | 1 + views.go | 2 +- 9 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 test.css diff --git a/.goreleaser.yml b/.goreleaser.yml index 1551ec0..ae17381 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,9 +10,9 @@ before: - rm -rf data/web - mkdir -p data - cp -r static data/web - - cp -r css data/web/ - npm install - - cp node_modules/a17t/dist/a17t.css data/web/css/ + - mkdir -p data/web/css + - npx esbuild --bundle css/base.css --outfile=build/data/web/css/bundle.css --external:remixicon.css --minify - cp node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 data/web/css/ - cp -r html data/ - cp -r lang data/ diff --git a/Makefile b/Makefile index 20680ab..362f127 100644 --- a/Makefile +++ b/Makefile @@ -43,11 +43,13 @@ compile: compress: upx --lzma build/jfa-go -copy: - $(info copying css) +bundle-css: -mkdir -p build/data/web/css - cp -r css build/data/web/ - cp node_modules/a17t/dist/a17t.css build/data/web/css/ + $(info bundling css) + npx esbuild --bundle css/base.css --outfile=build/data/web/css/bundle.css --external:remixicon.css --minify + +copy: + $(info copying fonts) cp -r node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 build/data/web/css/ $(info copying html) cp -r html build/data/ @@ -61,5 +63,5 @@ copy: install: cp -r build $(DESTDIR)/jfa-go -all: configuration npm email version typescript swagger compile copy -debug: configuration npm email version ts-debug swagger compile copy +all: configuration npm email version typescript bundle-css swagger compile copy +debug: configuration npm email version ts-debug bundle-css swagger compile copy diff --git a/css/base.css b/css/base.css index 75fde04..7a7386c 100644 --- a/css/base.css +++ b/css/base.css @@ -1,9 +1,9 @@ -@import "a17t.css"; +@import "../node_modules/a17t/dist/a17t.css"; @import "remixicon.css"; -@import "modal.css"; -@import "dark.css"; -@import "tooltip.css"; -@import "loader.css"; +@import "./modal.css"; +@import "./dark.css"; +@import "./tooltip.css"; +@import "./loader.css"; :root { --border-width-default: 2px; diff --git a/html/404.html b/html/404.html index 171610a..0ddd1f9 100644 --- a/html/404.html +++ b/html/404.html @@ -1,7 +1,7 @@ - + {{ template "header.html" . }} 404 - jfa-go diff --git a/html/admin.html b/html/admin.html index 519b821..f6ff2a6 100644 --- a/html/admin.html +++ b/html/admin.html @@ -1,7 +1,7 @@ - +