Josee9988 / MinifyAll

A 𝗩𝗦𝗖𝗼𝗱𝗲 𝗺𝗢𝗻𝗢𝗳𝗢𝗲𝗿 for JS, JSON/C, CSS, and HTML, you will love its simplicity! 🌟 π˜Ύπ™€π™’π™₯π™§π™šπ™¨π™¨ and π™œπ™―π™žπ™₯ files and folders πŸ“¦ Reduce your bundle and file sizes with lightning speed ⚑
https://minifyall.jgracia.es/
GNU General Public License v3.0
73 stars 13 forks source link

HTML spaces removed completely on line endings #16

Closed nigelboor closed 4 years ago

nigelboor commented 4 years ago

When minifying HTML file some of the words are combined.

Eg: This...


                                                    <p>The role will involve working within Gloucestershire&rsquo;s
                                                        countywide Continuing Health Care Team. You will be
                                                        completing CHC assessments and taking a vital role in the
                                                        multi-disciplinary team to complete the Decision Support
                                                        Tool (DST). This will include making decisions around
                                                        eligibility of a primary health need. You will work with
                                                        colleagues within the CHC team to ensure that a seamless
                                                        service is provided to all individuals who may become
                                                        eligible for CHC, have become ineligible for CHC or are CHC
                                                        funded. You will be involved in supporting the development
                                                        of partnership CHC practice by sharing CHC information with
                                                        locality champions for cascading to locality staff under the
                                                        direction of the CHC operational lead.</p>

Is minified to...


The role will involve working within Gloucestershire’scountywide Continuing Health Care Team. You will becompleting CHC assessments and taking a vital role in themulti-disciplinary team to complete the Decision SupportTool (DST). This will include making decisions aroundeligibility of a primary health need. You will work withcolleagues within the CHC team to ensure that a seamlessservice is provided to all individuals who may becomeeligible for CHC, have become ineligible for CHC or are CHCfunded. You will be involved in supporting the developmentof partnership CHC practice by sharing CHC information withlocality champions for cascading to locality staff under thedirection of the CHC operational lead.


VSCode is set to use spaces for indenting

Josee9988 commented 4 years ago

Hi @nigelboor , when I minify your code this is what it gives me:

<p>The role will involve working within Gloucestershire&rsquo;scountywide Continuing Health Care Team. You will becompleting CHC assessments and taking a vital role in themulti-disciplinary team to complete the Decision SupportTool (DST). This will include making decisions aroundeligibility of a primary health need. You will work withcolleagues within the CHC team to ensure that a seamlessservice is provided to all individuals who may becomeeligible for CHC, have become ineligible for CHC or are CHCfunded. You will be involved in supporting the developmentof partnership CHC practice by sharing CHC information withlocality champions for cascading to locality staff under thedirection of the CHC operational lead.</p>

I see the issue, and I'll try to fix this as soon as possible, thanks for letting me know!

Josee9988 commented 4 years ago

Hey, I've found there is not an existent issue in the spaces, but it is giving some bugs because your text is separated in multiple lines, and the extension tries to avoid multiple lines by removing them and creating just one line. If I let a space when we found a linebreak it will create multiple spaces between HTML labels and also within words.

The problem occurs because for example, the result:

locality champions for cascading to locality staff under the
                                                        direction

will give

thedirection

because after the it literally finds a linebreak and not space, so the extension could not imagine that this linebreak is a space, so it is not an extension bug, it is a problem with the code you gave, that is comprehensible for you but it is not for the extension.

To sum up all the mess I said, the extension detects spaces correctly but can not understand if linebreaks mean a space to you, this could be solved by adding a space after the word you want to have space, even if there is a linebreak after it.

Thanks for the interest!

nigelboor commented 4 years ago

The solution might be to first convert all line feeds to spaces then minify.

There’s no requirement in text files to terminate a line with space+return so this is something that the extension should handle. It’s a setting in VSCode "editor.trimAutoWhitespace": true

-- Nigel Boor

From: Jose Gracia Berenguer notifications@github.com Reply to: Josee9988/MinifyAll reply@reply.github.com Date: Friday, 10 January 2020 at 16:16 To: Josee9988/MinifyAll MinifyAll@noreply.github.com Cc: Nigel nigelboor@live.co.uk, Mention mention@noreply.github.com Subject: Re: [Josee9988/MinifyAll] HTML spaces removed completely on line endings (#16)

Hey, I've found there is not an existent issue in the spaces, but it is giving some bugs because your text is separated in multiple lines, and the extension tries to avoid multiple lines by removing them and creating just one line. If I let a space when we found a linebreak it will create multiple spaces between HTML labels and also within words.

The problem occurs because for example, the result:

locality champions for cascading to locality staff under the

                                                    direction

will give

thedirection

because after the it literally finds a linebreak and not space, so the extension could not imagine that this linebreak is a space, so it is not an extension bug, it is a problem with the code you gave, that is comprehensible for you but it is not for the extension.

To sum up all the mess I said, the extension detects spaces correctly but can not understand if linebreaks mean a space to you, this could be solved by adding a space after the word you want to have space, even if there is a linebreak after it.

Thanks for the interest!

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJosee9988%2FMinifyAll%2Fissues%2F16%3Femail_source%3Dnotifications%26email_token%3DABSGIUNCMOPVZTXSK45ZLU3Q5CNIXA5CNFSM4KFJTHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIUNELI%23issuecomment-573100589&data=02%7C01%7C%7Cc8ee662ee2cf429a13b008d795e842e1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637142697975938540&sdata=pPIZlBJgLDehlnjXbebpyvaE98AiTWUlgS2%2BMB%2BT2UY%3D&reserved=0, or unsubscribehttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABSGIUOBRTS3Y2QZSPL4R6LQ5CNIXANCNFSM4KFJTHCA&data=02%7C01%7C%7Cc8ee662ee2cf429a13b008d795e842e1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637142697975948544&sdata=vviGbYyOpk%2F95hwHLkBXmS%2B0G60uHyP18I4JopsrTM0%3D&reserved=0.

Josee9988 commented 4 years ago

I'll take a deeper look in how to handle it. Stay tuned.

Josee9988 commented 4 years ago

It is fixed in the new version 2.1.1. Download it and test it out, if there is any other problem or the original one wasn't solved as you expected to, feel free to keep posting issues or simply telling me.

Thanks for trying to make this extension better, your help is highly appreciated!

nigelboor commented 4 years ago

That fixes the problem, thanks.

I can see one remaining issue: the extension still reduces β€œ β€œ to β€œβ€ – it should preserve the space.

I’ve also checked two other inline elements and , and similarly β€œ β€œ is reduced to β€œβ€ and β€œ β€œ to β€œβ€.

Other inline elements will have similar issues when trailing spaces are removed although which other HTML elements should have preserved trailing space would need evaluation.

-- Nigel Boor

From: Jose Gracia Berenguer notifications@github.com Reply to: Josee9988/MinifyAll reply@reply.github.com Date: Friday, 10 January 2020 at 18:50 To: Josee9988/MinifyAll MinifyAll@noreply.github.com Cc: Nigel nigelboor@live.co.uk, Mention mention@noreply.github.com Subject: Re: [Josee9988/MinifyAll] HTML spaces removed completely on line endings (#16)

It is fixed in the new version 2.1.1. Download it and test it out, if there is any other problem or the original one wasn't solved as you expected to, feel free to keep posting issues or simply telling me.

Thanks for trying to make this extension better, your help is highly appreciated!

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJosee9988%2FMinifyAll%2Fissues%2F16%3Femail_source%3Dnotifications%26email_token%3DABSGIUMNLDUXUCJ2FOC2FETQ5C7ONA5CNFSM4KFJTHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIU3ULQ%23issuecomment-573159982&data=02%7C01%7C%7C61bf05570cc94b0a921a08d795fdeeac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637142790398115284&sdata=TzBlc3t%2BuYiAVeN%2Fx7bfftkb5wl0e740GgvZLKi9fg8%3D&reserved=0, or unsubscribehttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABSGIUMT5DYJFK3W34EG72DQ5C7ONANCNFSM4KFJTHCA&data=02%7C01%7C%7C61bf05570cc94b0a921a08d795fdeeac%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637142790398125294&sdata=5kAEmqs2Z4yaO4HH8pKx6pFF0wUvNfuX6NCSzHfwpwU%3D&reserved=0.

Josee9988 commented 4 years ago

Ow, you are completely right, but I'm afraid to say this won't be fixed anytime soon, because I'm doing it with regex and there is no way to distinct if the "> " that I'm looking is from a strong label or not. :sleepy:

nigelboor commented 4 years ago

Good luck & I hope you crack it.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jose Gracia Berenguer notifications@github.com Sent: Saturday, January 11, 2020 7:58:23 AM To: Josee9988/MinifyAll MinifyAll@noreply.github.com Cc: Nigel nigelboor@live.co.uk; Mention mention@noreply.github.com Subject: Re: [Josee9988/MinifyAll] HTML spaces removed completely on line endings (#16)

Ow, you are completely right, but I'm afraid to say this won't be fixed anytime soon, because I'm doing it with regex and there is no way to distinct if the "> " that I'm looking is from a strong label or not. πŸ˜ͺ

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJosee9988%2FMinifyAll%2Fissues%2F16%3Femail_source%3Dnotifications%26email_token%3DABSGIUJAHIHNEWHFPTO5NA3Q5F3Z7A5CNFSM4KFJTHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIV4EYY%23issuecomment-573293155&data=02%7C01%7C%7C831b87db55684b6674bb08d7966c0887%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637143263044974364&sdata=fhD27MAI5kO9BCzBdj4iESZo85R7IRx9aLkhmluGEoo%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABSGIULFFJU355WCSH4TF2LQ5F3Z7ANCNFSM4KFJTHCA&data=02%7C01%7C%7C831b87db55684b6674bb08d7966c0887%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637143263044984369&sdata=1e6P1xBiHcdsaVkaVfMDcdVLvbfb3uDDvelaSe0sIWM%3D&reserved=0.