From 77695494977d6b843a84f07923d333387eee4cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=BD=C3=A1k?= Date: Sun, 3 Oct 2021 12:28:38 +0200 Subject: [PATCH] Remove multiline comments with compress option --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ffae8ed..eaf0769 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ const { compile } = require('glslify'); function compressShader(code) { let needNewline = false; - return code.replace(/\\(?:\r\n|\n\r|\n|\r)|\/\*.*?\*\/|\/\/(?:\\(?:\r\n|\n\r|\n|\r)|[^\n\r])*/g, '').split(/\n+/).reduce((result, line) => { + return code.replace(/\\(?:\r\n|\n\r|\n|\r)|\/\*.*?\*\/|\/\/(?:\\(?:\r\n|\n\r|\n|\r)|[^\n\r])*/gs, '').split(/\n+/).reduce((result, line) => { line = line.trim().replace(/\s{2,}|\t/, ' '); if (line.charAt(0) === '#') { if (needNewline) {