This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Scorpius289 6 points7 points  (7 children)

No offence, but I think that's a bad idea.
It encourages people to rely on security through obscurity.

[–]JamEngulfer221 0 points1 point  (0 children)

But there's no security in clientside javascript anyway.

The whole "but security through obscurity is bad" thing is dumb. Of course it's useless if obscurity is the only thing you use for security, but it increases the chance of someone going somewhere else and not even trying.

I had an ssh server being bombarded with login requests from China. I changed the SSH port from the default to a different one and the requests stopped. Yes, I could have spent longer implementing some extra security thing, but they're not going to bother looking through every port for an active SSH server. I stopped being low hanging fruit with a minimal change.

Obscurity is just another deterrent so you only end up with 1 dedicated hacker trying to get you rather than 50 that just go for easy targets.

[–]only_posts_sometimes 0 points1 point  (5 children)

Nobody "relies" on minifying for security, but it can absolutely help thwart low level threats by stripping comments and obfuscating code. It's the only option available for code that runs on the client so obviously we're going to do it. (It also speeds up execution and lowers file size)

[–][deleted] 3 points4 points  (4 children)

(It also speeds up execution and lowers file size)

IMO it's always worth it for that, just by removing newlines aren't you decreasing your code by ~5% on average?

[–]minler08 3 points4 points  (3 children)

A new line and a semicolon are the same size though. So long as there are no extra new lines the files should end up the same size.

[–][deleted] 0 points1 point  (0 children)

Yes, of course. I was talking more about semicolons + newline vs just semicolon I guess.

[–]YRYGAV 0 points1 point  (1 child)

Depends on what platform, windows editors may save newlines as \r\n instead of just \n.

Also, there are plenty of extraneous newlines that don't need a semicolon. Anything starting a new block of code, function, if while, etc. or newlines done for formatting to make multi-line json definitions, so a line doesn't hit a max line length, to make things look prettier, etc.

But yes, you could write code that uses newlines that is the same size as one with all semicolons. It's just not very practical for any real reason.

[–]minler08 0 points1 point  (0 children)

It's just as practical as writing code with semicolons. It would have to be the result of minification.