Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard lessc and minify CSS using Node.js #2337

Merged
merged 5 commits into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pipeline:
TAGS: bindata sqlite
GOPATH: /srv/app
commands:
- apk -U add nodejs nodejs-npm
- npm install
- make clean
- make generate
- make vet
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ coverage.all
/integrations/indexers-sqlite
/integrations/mysql.ini
/integrations/pgsql.ini
/node_modules
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ and is synced regularily to Crowdin. Once a translation has reached
A SATISFACTORY PERCENTAGE it will be synced back into this repo and
included in the next released version.

## Building Gitea

Generally, the go build tools are installed as-needed in the `Makefile`.
An exception are the tools to build the CSS and images.

- To build CSS: Install [Node.js](https://nodejs.org/en/download/package-manager)
with `npm` and then run `npm install` and `make stylesheets`.
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
available in your `PATH` to run `make generate-images`.

## Code review

Changes to Gitea must be reviewed before they are accepted, no matter who
Expand Down
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ else
endif

BINDATA := modules/{options,public,templates}/bindata.go
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
DOCKER_TAG := gitea/gitea:latest
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
GOFMT ?= gofmt -s
Expand Down Expand Up @@ -299,14 +298,12 @@ stylesheets-check: stylesheets
fi;

.PHONY: stylesheets
stylesheets: public/css/index.css

.IGNORE: public/css/index.css
public/css/index.css: $(STYLESHEETS)
@which lessc > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/kib357/less-go/lessc; \
stylesheets:
@hash minify > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/tdewolff/minify/cmd/minify; \
fi
lessc -i $< -o $@
node_modules/.bin/lessc --no-ie-compat public/less/index.less public/css/index.css
minify -o public/css/index.css public/css/index.css

.PHONY: swagger-ui
swagger-ui:
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"license": "MIT",
"dependencies": {
"less": "^2.7.2"
}
}