Closed IamMusavaRibica closed 2 years ago
Hi @IamMusavaRibica
Python itself doesn't care what the line endings are, as long as it's consistent throughout a file. As you said, python-minifier only outputs a linefeed character for newlines.
I haven't ever tested on windows 😬, but I don't think there is any chance of breakage as long as the output file isn't changed to insert a carriage return. I wouldn't recommend manually editing the output on any platform, but I would hope any windows editors follow the newline convention in the file. Even if it doesn't, as long as it replaces all newlines with CRLF it shouldn't break anything.
The idea of using semicolons when possible also came up in #25, for a slightly different reason.
If think it would be good to add a --prefer-semicolons
or similar argument to enable this.
A PR would be welcome. It would be a fairly small change but testing can take a long time, so it may take a while to get merged.
Since python-minifier already uglifies the code, I don't see a reason why would one ever want improved readability by using line breaks instead of semicolons. Sure it is sometimes inevitable to use a linebreak though. I'll see what I can do about it in the upcoming days
I am going to remember this issue and start working on a PR in about a month, I'll close this for now. Thank you once again for your response
Hello!
So I noticed that python-minifier, when for example encounters a builtin function used multiple times, assigns it to a variable at the very beginning:
E=print
However, when it does so multiple times, they are put each in their own line. On Windows, a new line consists of a carriage return and line break. It is 2 bytes on its own. Using a semicolon would take only 1 byte.How would one go about making this change? I would make a pull request myself if I find any time to do it myself
I opened this issue to discuss, and point out possible drawbacks of this
(I know that by default it inserts only LINE FEED character, but when porting code across multiple machines this might or might not break?)