Skip to content

Commit 971e512

Browse files
unknwonmpsonntag
authored andcommitted
public: make lessc compile minimize CSS (#5987)
1 parent e508308 commit 971e512

File tree

9 files changed

+36
-3272
lines changed

9 files changed

+36
-3272
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')
66
PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g')
77
LESS_FILES := $(wildcard public/less/*.less)
88
ASSETS_GENERATED := internal/assets/conf/conf_gen.go internal/assets/templates/templates_gen.go internal/assets/public/public_gen.go
9-
GENERATED := $(ASSETS_GENERATED) public/css/gogs.css
9+
GENERATED := $(ASSETS_GENERATED) public/css/gogs.min.css
1010

1111
TAGS = ""
1212
BUILD_FLAGS = "-v"
@@ -59,10 +59,10 @@ internal/assets/public/public_gen.go: $(PUBLIC_FILES)
5959
go generate internal/assets/public/public.go
6060
gofmt -s -w $@
6161

62-
less: public/css/gogs.css
62+
less: public/css/gogs.min.css
6363

64-
public/css/gogs.css: $(LESS_FILES)
65-
@type lessc >/dev/null 2>&1 && lessc --source-map "public/less/gogs.less" $@ || echo "lessc command not found or failed"
64+
public/css/gogs.min.css: $(LESS_FILES)
65+
@type lessc >/dev/null 2>&1 && lessc --clean-css --source-map "public/less/gogs.less" $@ || echo "lessc command not found or failed"
6666

6767
clean:
6868
find . -name "*.DS_Store" -type f -delete

docs/local_development.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Gogs has the following dependencies:
4141
```bash
4242
brew install go postgresql git go-bindata npm
4343
npm install -g less
44+
npm install -g less-plugin-clean-css
4445
```
4546

4647
1. Configure PostgreSQL to start automatically:

internal/assets/public/public_gen.go

+24-24
Large diffs are not rendered by default.

internal/assets/templates/templates_gen.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)