I like code compression as a demo version.
How to force such code compression using only 5 lines when we see a source within browser?
An example: https://www.a11yproject.com/
I like code compression as a demo version.
How to force such code compression using only 5 lines when we see a source within browser?
An example: https://www.a11yproject.com/
thereâs no real âcompressionâ there, itâs just removing all the whitespaces. Browsers dont care about whitespace between tags, itâs only humans that care.
regular expression remove \s
from your source, and you have âcompressedâ the code.
Wonât that also remove the spaces that are actually needed, such as in <!DOCTYPE html>
?
probably. I was being lazy.
replacing [\t\r\n]
will get you most of the way. Youâll have some spaces laying around in weird places. If youâre using tabs or line breaks inside tags, youâve got other problems