{"action":"created","issue":{"url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/111","repository_url":"https://api.github.com/repos/renatomarinho/laravel-page-speed","labels_url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/111/comments","events_url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/111/events","html_url":"https://github.com/renatomarinho/laravel-page-speed/pull/111","id":492558919,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE2NzA4Mjk0","number":111,"title":"Fix bugs and code improvements","user":{"login":"joaorobertopb","id":6556083,"node_id":"MDQ6VXNlcjY1NTYwODM=","avatar_url":"https://avatars1.githubusercontent.com/u/6556083?v=4","gravatar_id":"","url":"https://api.github.com/users/joaorobertopb","html_url":"https://github.com/joaorobertopb","followers_url":"https://api.github.com/users/joaorobertopb/followers","following_url":"https://api.github.com/users/joaorobertopb/following{/other_user}","gists_url":"https://api.github.com/users/joaorobertopb/gists{/gist_id}","starred_url":"https://api.github.com/users/joaorobertopb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaorobertopb/subscriptions","organizations_url":"https://api.github.com/users/joaorobertopb/orgs","repos_url":"https://api.github.com/users/joaorobertopb/repos","events_url":"https://api.github.com/users/joaorobertopb/events{/privacy}","received_events_url":"https://api.github.com/users/joaorobertopb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-09-12T03:01:35Z","updated_at":"2019-09-14T13:42:25Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/pulls/111","html_url":"https://github.com/renatomarinho/laravel-page-speed/pull/111","diff_url":"https://github.com/renatomarinho/laravel-page-speed/pull/111.diff","patch_url":"https://github.com/renatomarinho/laravel-page-speed/pull/111.patch"},"body":"## Description\r\n\r\nThis big PR will:\r\n\r\n- **Drop** support for **Laravel <5.5**;\r\n- Bump PHP minimun version to **7.1.3+**;\r\n- Update dependency constraints in **composer.json**;\r\n- Recfator all tests:\r\n  - Remove deprecated functions e prepare code to next **phpunit 9.0** version;\r\n  - Improvements tests coverage;\r\n- Fix **RemoveComments** middleware, now it remove JS and CSS comments;\r\n- Fix **CollapseWhitespace**, now dependent on 'RemoveComments' middleware;\r\n- Update the old phpunit.xml configuration file;\r\n- Update the .travis.yml file and run the tests against in PHP 7.3 / PHP 7.4;\r\n- Update README.md;\r\n\r\n## Motivation and context\r\n\r\nWhy is this change required? What problem does it solve?\r\n\r\nIt fixes: #30 #46 #55 #57 #77 #82  #107 #108 \r\n\r\nThe **CollapseWriteSpace::class** filter was producing a bug when the HTML contains inline JS comments.... **All JS code after the inline comment was also commented!**\r\n\r\n**For example:**\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n    <head>\r\n        <meta charset=\"utf-8\">\r\n        <meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\">\r\n        <title></title>\r\n        <meta name=\"description\" content=\"\">\r\n    </head>\r\n    <body>\r\n        <script>\r\n            // Alert Hello!!\r\n            alert('Hello!!');\r\n\r\n            // Log Hello!!\r\n            console.log('Hello!!');\r\n        </script>\r\n    </body>\r\n</html>\r\n```\r\n\r\n**After filter apply:**\r\n\r\n```html\r\n<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\"><title></title><meta name=\"description\" content=\"\"></head><body><script> // Alert Hello!! alert('Hello!!'); // Log Hello!! console.log('Hello!!'); </script></body></html>\r\n```\r\n\r\n### What is the solution?\r\n\r\nWe have to remove all inline JS comments before the 'CollapseWriteSpace' filter is executed.\r\n\r\n:thinking: ... Okay, we need to make sure **RemoveComments::class** filter always runs before **CollapseWriteSpace::class** filter!\r\n\r\nAll right, it's done:\r\n\r\nhttps://github.com/renatomarinho/laravel-page-speed/blob/efc2f37456c1ded881b7a158eaf5f53343be7b89/src/Middleware/CollapseWhitespace.php#L5-L25\r\n\r\n### But...\r\n\r\nOooh Nooo! The **RemoveComments::class** filter was only removing HTML comments :man_facepalming:...\r\n\r\nNot problem ... **RemoveComments::class** has been updated! Now, it removes HTML, JS and CSS comments:\r\n\r\nhttps://github.com/renatomarinho/laravel-page-speed/blob/332cbf6a774e05e17480584247697aa6397c8dba/src/Middleware/RemoveComments.php#L5-L16\r\n\r\n## How has this been tested?\r\n\r\nRefactoring and improve test coverage.\r\n\r\n## Types of changes\r\n\r\nWhat types of changes does your code introduce? Put an `x` in all the boxes that apply:\r\n- [x] Bugfix / Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n\r\n- [x] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.\r\n- [x] My pull request addresses exactly one patch/feature.\r\n- [x] I have created a branch for this patch/feature.\r\n- [x] Each individual commit in the pull request is meaningful.\r\n- [x] I have added tests to cover my changes.\r\n- [x] If my change requires a change to the documentation, I have updated it accordingly.\r\n\r\n<hr>\r\n\r\nI did a lot of testing and it seems to be working okay...\r\n\r\n**Can someone help me to test this PR, please?** :smile:\r\n\r\nPing @renatomarinho "},"comment":{"url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/comments/531480701","html_url":"https://github.com/renatomarinho/laravel-page-speed/pull/111#issuecomment-531480701","issue_url":"https://api.github.com/repos/renatomarinho/laravel-page-speed/issues/111","id":531480701,"node_id":"MDEyOklzc3VlQ29tbWVudDUzMTQ4MDcwMQ==","user":{"login":"muarachmann","id":16350814,"node_id":"MDQ6VXNlcjE2MzUwODE0","avatar_url":"https://avatars2.githubusercontent.com/u/16350814?v=4","gravatar_id":"","url":"https://api.github.com/users/muarachmann","html_url":"https://github.com/muarachmann","followers_url":"https://api.github.com/users/muarachmann/followers","following_url":"https://api.github.com/users/muarachmann/following{/other_user}","gists_url":"https://api.github.com/users/muarachmann/gists{/gist_id}","starred_url":"https://api.github.com/users/muarachmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muarachmann/subscriptions","organizations_url":"https://api.github.com/users/muarachmann/orgs","repos_url":"https://api.github.com/users/muarachmann/repos","events_url":"https://api.github.com/users/muarachmann/events{/privacy}","received_events_url":"https://api.github.com/users/muarachmann/received_events","type":"User","site_admin":false},"created_at":"2019-09-14T13:42:25Z","updated_at":"2019-09-14T13:42:25Z","author_association":"NONE","body":"@joaorobertopb thanks will test and get back to you"}}
{"actor":{"display_login":"muarachmann"}}