mathiasbynens / luamin

A Lua minifier written in JavaScript
https://mths.be/luamin
MIT License
216 stars 55 forks source link

Option to maintain line numbers? #82

Open swampservers opened 3 years ago

swampservers commented 3 years ago

It would be really nice to have the option to keep all statements at the same line number as they are in the input, for debugging errors in minified code.

Current output:

for a=1,10 do for b=1,10 do for c=1,10 do if c^2+b^2==a^2 then print('found a Pythagorean triple:',c,b,a)goto d end end end end::d::

Proposed output:

for a=1,10 do
for b=1,10 do
for c=1,10 do
if c^2+b^2==a^2 then
print('found a Pythagorean triple:',c,b,a)
goto d
end
end
end
end
::d::

It's pretty much the same size anyway, some spaces just turn into newlines.