Browse Source

Bugfix

master
luk3yx 1 month ago
parent
commit
6745d01e32
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      minify.lua

+ 8
- 1
minify.lua View File

@@ -8,7 +8,7 @@ return function(code)
assert(type(code) == 'string')

local res, last, ws1, ws2, escape = '', false, '\n', '\n', false
local sp = {['"'] = true, ["'"] = true}
local sp = {['"'] = true, ["'"] = true, ['['] = true}

for i = 1, #code do
local char = code:sub(i, i)
@@ -54,6 +54,13 @@ return function(code)
elseif last == '"' or last == "'" then
if char == last then last = false end
res = res .. char
elseif last == '[' then
if char == last then
last = last .. char
else
last = false
end
res = res .. char
elseif last == '-' then
if char == '-' then
last, ws1 = '--', ws2

Loading…
Cancel
Save