add css minifier
This commit is contained in:
		
							parent
							
								
									7650081220
								
							
						
					
					
						commit
						1dccff66bf
					
				
							
								
								
									
										33
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										33
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -10,6 +10,7 @@ | ||||
|       "license": "ISC", | ||||
|       "dependencies": { | ||||
|         "body-parser": "^1.20.0", | ||||
|         "clean-css": "^5.3.1", | ||||
|         "cookie-parser": "^1.4.6", | ||||
|         "csurf": "^1.11.0", | ||||
|         "ejs": "^3.1.8", | ||||
| @ -658,6 +659,17 @@ | ||||
|         "url": "https://github.com/chalk/chalk?sponsor=1" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/clean-css": { | ||||
|       "version": "5.3.1", | ||||
|       "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.1.tgz", | ||||
|       "integrity": "sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg==", | ||||
|       "dependencies": { | ||||
|         "source-map": "~0.6.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">= 10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/color-convert": { | ||||
|       "version": "2.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", | ||||
| @ -1709,6 +1721,14 @@ | ||||
|         "url": "https://github.com/sponsors/ljharb" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/source-map": { | ||||
|       "version": "0.6.1", | ||||
|       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", | ||||
|       "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", | ||||
|       "engines": { | ||||
|         "node": ">=0.10.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/spdy": { | ||||
|       "version": "4.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", | ||||
| @ -2488,6 +2508,14 @@ | ||||
|         "supports-color": "^7.1.0" | ||||
|       } | ||||
|     }, | ||||
|     "clean-css": { | ||||
|       "version": "5.3.1", | ||||
|       "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.1.tgz", | ||||
|       "integrity": "sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg==", | ||||
|       "requires": { | ||||
|         "source-map": "~0.6.0" | ||||
|       } | ||||
|     }, | ||||
|     "color-convert": { | ||||
|       "version": "2.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", | ||||
| @ -3318,6 +3346,11 @@ | ||||
|         "object-inspect": "^1.9.0" | ||||
|       } | ||||
|     }, | ||||
|     "source-map": { | ||||
|       "version": "0.6.1", | ||||
|       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", | ||||
|       "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" | ||||
|     }, | ||||
|     "spdy": { | ||||
|       "version": "4.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| { | ||||
|   "dependencies": { | ||||
|     "body-parser": "^1.20.0", | ||||
|     "clean-css": "^5.3.1", | ||||
|     "cookie-parser": "^1.4.6", | ||||
|     "csurf": "^1.11.0", | ||||
|     "ejs": "^3.1.8", | ||||
|  | ||||
							
								
								
									
										16
									
								
								server.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								server.js
									
									
									
									
									
								
							| @ -841,18 +841,30 @@ function load_var(fina) { | ||||
|     if(fina.endsWith(".js")) { | ||||
|         return min_js(out.toString()).code | ||||
|     } | ||||
| 
 | ||||
|     if(fina.endsWith(".css")) { | ||||
|         const { | ||||
|             styles, | ||||
|             errors, | ||||
|         } = new Clean({}).minify(out.toString()); | ||||
|         return styles | ||||
|     } | ||||
|      | ||||
|     return out | ||||
| } | ||||
| 
 | ||||
| import {minify as min_js} from "uglify-js" | ||||
| import Clean from 'clean-css'; | ||||
| 
 | ||||
| 
 | ||||
| const global_page_variables = { | ||||
|     globalcss: load_var("./css/global.css"), | ||||
|     httppostjs: load_var("./js/httppost.js"), | ||||
|     addnavbar: load_var("./js/addnavbar.js"), | ||||
|     navbar: load_var("./extra_modules/navbar.html"), | ||||
|     markdownjs: load_var("./js/markdown.js"), | ||||
|     htmlescapejs: load_var("./js/htmlescape.js"), | ||||
|     warnmessagejs: load_var("./js/warn_message.js") | ||||
|     warnmessagejs: load_var("./js/warn_message.js"), | ||||
|     loadfile: load_var | ||||
| } | ||||
| 
 | ||||
| router.get("/*", async function(request, response) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user