Browse Source

Compress css with nodejs (#2580)

Morlinest 2 years ago
parent
commit
086eb62691
3 changed files with 12 additions and 15 deletions
  1. 5 9
      Makefile
  2. 6 5
      package.json
  3. 1 1
      public/css/index.css

+ 5 - 9
Makefile

@@ -289,21 +289,17 @@ public/js/index.js: $(JAVASCRIPTS)
289 289
 	cat $< >| $@
290 290
 
291 291
 .PHONY: stylesheets-check
292
-stylesheets-check: stylesheets
292
+stylesheets-check: generate-stylesheets
293 293
 	@diff=$$(git diff public/css/index.css); \
294 294
 	if [ -n "$$diff" ]; then \
295
-		echo "Please run 'make stylesheets' and commit the result:"; \
295
+		echo "Please run 'make generate-stylesheets' and commit the result:"; \
296 296
 		echo "$${diff}"; \
297 297
 		exit 1; \
298 298
 	fi;
299 299
 
300
-.PHONY: stylesheets
301
-stylesheets:
302
-	@hash minify > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
303
-		$(GO) get -u github.com/tdewolff/minify/cmd/minify; \
304
-	fi
305
-	node_modules/.bin/lessc --no-ie-compat public/less/index.less public/css/index.css
306
-	minify -o public/css/index.css public/css/index.css
300
+.PHONY: generate-stylesheets
301
+generate-stylesheets:
302
+	node_modules/.bin/lessc --no-ie-compat --clean-css public/less/index.less public/css/index.css
307 303
 
308 304
 .PHONY: swagger-ui
309 305
 swagger-ui:

+ 6 - 5
package.json

@@ -1,6 +1,7 @@
1 1
 {
2
-  "license": "MIT",
3
-  "dependencies": {
4
-    "less": "^2.7.2"
5
-  }
6
-}
2
+    "license": "MIT",
3
+    "devDependencies": {
4
+        "less": "^2.7.2",
5
+        "less-plugin-clean-css": "^1.5.1"
6
+    }
7
+}

File diff suppressed because it is too large
+ 1 - 1
public/css/index.css