Skip to content

Commit

Permalink
Compress css with nodejs (go-gitea#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
Morlinest authored and lafriks committed Sep 24, 2017
1 parent fa6d7c7 commit 086eb62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,17 @@ public/js/index.js: $(JAVASCRIPTS)
cat $< >| $@

.PHONY: stylesheets-check
stylesheets-check: stylesheets
stylesheets-check: generate-stylesheets
@diff=$$(git diff public/css/index.css); \
if [ -n "$$diff" ]; then \
echo "Please run 'make stylesheets' and commit the result:"; \
echo "Please run 'make generate-stylesheets' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;

.PHONY: stylesheets
stylesheets:
@hash minify > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/tdewolff/minify/cmd/minify; \
fi
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: generate-stylesheets
generate-stylesheets:
node_modules/.bin/lessc --no-ie-compat --clean-css public/less/index.less public/css/index.css

.PHONY: swagger-ui
swagger-ui:
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"license": "MIT",
"dependencies": {
"less": "^2.7.2"
}
}
"license": "MIT",
"devDependencies": {
"less": "^2.7.2",
"less-plugin-clean-css": "^1.5.1"
}
}
2 changes: 1 addition & 1 deletion public/css/index.css

Large diffs are not rendered by default.

0 comments on commit 086eb62

Please sign in to comment.