Skip to content

Commit

Permalink
public: make lessc compile minimize CSS (#5987)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Mar 14, 2020
1 parent 268c692 commit 328c23c
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 3,297 deletions.
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -6,7 +6,7 @@ TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')
PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g')
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
GENERATED := $(ASSETS_GENERATED) public/css/gogs.css
GENERATED := $(ASSETS_GENERATED) public/css/gogs.min.css

TAGS = ""
BUILD_FLAGS = "-v"
Expand Down Expand Up @@ -59,10 +59,10 @@ internal/assets/public/public_gen.go: $(PUBLIC_FILES)
go generate internal/assets/public/public.go
gofmt -s -w $@

less: public/css/gogs.css
less: public/css/gogs.min.css

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

clean:
find . -name "*.DS_Store" -type f -delete
Expand Down
1 change: 1 addition & 0 deletions docs/local_development.md
Expand Up @@ -41,6 +41,7 @@ Gogs has the following dependencies:
```bash
brew install go postgresql git go-bindata npm
npm install -g less
npm install -g less-plugin-clean-css
```

1. Configure PostgreSQL to start automatically:
Expand Down
73 changes: 25 additions & 48 deletions internal/assets/public/public_gen.go

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions internal/assets/templates/templates_gen.go

Large diffs are not rendered by default.

0 comments on commit 328c23c

Please sign in to comment.