public: make lessc compile minimize CSS (#5987)

This commit is contained in:
ᴜɴᴋɴᴡᴏɴ 2020-03-15 03:47:07 +08:00 committed by GitHub
parent 268c692efd
commit 328c23c5d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 3297 deletions

View File

@ -6,7 +6,7 @@ TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')
PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g') PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g')
LESS_FILES := $(wildcard public/less/*.less) LESS_FILES := $(wildcard public/less/*.less)
ASSETS_GENERATED := internal/assets/conf/conf_gen.go internal/assets/templates/templates_gen.go internal/assets/public/public_gen.go ASSETS_GENERATED := internal/assets/conf/conf_gen.go internal/assets/templates/templates_gen.go internal/assets/public/public_gen.go
GENERATED := $(ASSETS_GENERATED) public/css/gogs.css GENERATED := $(ASSETS_GENERATED) public/css/gogs.min.css
TAGS = "" TAGS = ""
BUILD_FLAGS = "-v" BUILD_FLAGS = "-v"
@ -59,10 +59,10 @@ internal/assets/public/public_gen.go: $(PUBLIC_FILES)
go generate internal/assets/public/public.go go generate internal/assets/public/public.go
gofmt -s -w $@ gofmt -s -w $@
less: public/css/gogs.css less: public/css/gogs.min.css
public/css/gogs.css: $(LESS_FILES) public/css/gogs.min.css: $(LESS_FILES)
@type lessc >/dev/null 2>&1 && lessc --source-map "public/less/gogs.less" $@ || echo "lessc command not found or failed" @type lessc >/dev/null 2>&1 && lessc --clean-css --source-map "public/less/gogs.less" $@ || echo "lessc command not found or failed"
clean: clean:
find . -name "*.DS_Store" -type f -delete find . -name "*.DS_Store" -type f -delete

View File

@ -41,6 +41,7 @@ Gogs has the following dependencies:
```bash ```bash
brew install go postgresql git go-bindata npm brew install go postgresql git go-bindata npm
npm install -g less npm install -g less
npm install -g less-plugin-clean-css
``` ```
1. Configure PostgreSQL to start automatically: 1. Configure PostgreSQL to start automatically:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1
public/css/gogs.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@
<!-- Stylesheet --> <!-- Stylesheet -->
<link rel="stylesheet" href="{{AppSubURL}}/css/semantic-2.4.2.min.css"> <link rel="stylesheet" href="{{AppSubURL}}/css/semantic-2.4.2.min.css">
<link rel="stylesheet" href="{{AppSubURL}}/css/gogs.css?v={{BuildCommit}}"> <link rel="stylesheet" href="{{AppSubURL}}/css/gogs.min.css?v={{BuildCommit}}">
<noscript> <noscript>
<style> <style>
.dropdown:hover > .menu { display: block; } .dropdown:hover > .menu { display: block; }