1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10:10 +00:00

bundle css with esbuild

This commit is contained in:
Harvey Tindall 2021-01-23 18:53:14 +00:00
parent cd2ea2e579
commit f7d8feac5d
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
9 changed files with 21 additions and 18 deletions

View File

@ -10,9 +10,9 @@ before:
- rm -rf data/web - rm -rf data/web
- mkdir -p data - mkdir -p data
- cp -r static data/web - cp -r static data/web
- cp -r css data/web/
- npm install - 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 node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 data/web/css/
- cp -r html data/ - cp -r html data/
- cp -r lang data/ - cp -r lang data/

View File

@ -43,11 +43,13 @@ compile:
compress: compress:
upx --lzma build/jfa-go upx --lzma build/jfa-go
copy: bundle-css:
$(info copying css)
-mkdir -p build/data/web/css -mkdir -p build/data/web/css
cp -r css build/data/web/ $(info bundling css)
cp node_modules/a17t/dist/a17t.css build/data/web/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/ cp -r node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 build/data/web/css/
$(info copying html) $(info copying html)
cp -r html build/data/ cp -r html build/data/
@ -61,5 +63,5 @@ copy:
install: install:
cp -r build $(DESTDIR)/jfa-go cp -r build $(DESTDIR)/jfa-go
all: configuration npm email version typescript swagger compile copy all: configuration npm email version typescript bundle-css swagger compile copy
debug: configuration npm email version ts-debug swagger compile copy debug: configuration npm email version ts-debug bundle-css swagger compile copy

View File

@ -1,9 +1,9 @@
@import "a17t.css"; @import "../node_modules/a17t/dist/a17t.css";
@import "remixicon.css"; @import "remixicon.css";
@import "modal.css"; @import "./modal.css";
@import "dark.css"; @import "./dark.css";
@import "tooltip.css"; @import "./tooltip.css";
@import "loader.css"; @import "./loader.css";
:root { :root {
--border-width-default: 2px; --border-width-default: 2px;

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="{{ .cssClass }}"> <html lang="en" class="{{ .cssClass }}">
<head> <head>
<link rel="stylesheet" type="text/css" href="css/base.css"> <link rel="stylesheet" type="text/css" href="css/bundle.css">
{{ template "header.html" . }} {{ template "header.html" . }}
<title>404 - jfa-go</title> <title>404 - jfa-go</title>
</head> </head>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="{{ .cssClass }}"> <html lang="en" class="{{ .cssClass }}">
<head> <head>
<link rel="stylesheet" type="text/css" href="css/base.css"> <link rel="stylesheet" type="text/css" href="css/bundle.css">
<script> <script>
window.URLBase = "{{ .urlBase }}"; window.URLBase = "{{ .urlBase }}";
window.notificationsEnabled = {{ .notifications }}; window.notificationsEnabled = {{ .notifications }};

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="{{ .cssClass }}"> <html lang="en" class="{{ .cssClass }}">
<head> <head>
<link rel="stylesheet" type="text/css" href="css/base.css"> <link rel="stylesheet" type="text/css" href="css/bundle.css">
{{ template "header.html" . }} {{ template "header.html" . }}
<title>{{ .strings.pageTitle }}</title> <title>{{ .strings.pageTitle }}</title>
</head> </head>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="{{ .cssClass }}"> <html lang="en" class="{{ .cssClass }}">
<head> <head>
<link rel="stylesheet" type="text/css" href="css/base.css"> <link rel="stylesheet" type="text/css" href="css/bundle.css">
{{ template "header.html" . }} {{ template "header.html" . }}
<title>Invalid Code - jfa-go</title> <title>Invalid Code - jfa-go</title>
</head> </head>

1
test.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
var css = []string{"base.css", "a17t.css", "remixicon.css", "modal.css", "dark.css", "tooltip.css", "loader.css"} var css = []string{"bundle.css", "remixicon.css"}
var cssHeader = func() string { var cssHeader = func() string {
l := len(css) l := len(css)
h := "" h := ""