-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.x] Fix bugs and code improvements #111
[2.x] Fix bugs and code improvements #111
Conversation
@joaorobertopb thanks will test and get back to you |
Also, i noticed that the Urls were truncated when the application is served |
@muarachmann yes man, it is correct. See: \RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,The TrimUrls::class filter trims URLs by resolving them by making them relative to the base URL for the page.
|
@joaorobertopb beautiful PR. Very clean and documented. Tested and cannot appear to find any issues yet. Will report back if do find something this weekend. |
Hi @joaorobertopb tested on a live laravel (5.8) application and it seems to be breaking on the For example here is a sample page and it seems to break on line 9 https://gist.github.com/muarachmann/a020549549e332c8304a5cecce270c14 as seen below.
Not sure of what is happening as i instead suspected the TrimUrls to behave as such. |
And also just noticed my laravel debug screen shows blank without the usual laravel debug screen if an error occurs. It just returns a 500 error |
Hi @muarachmann, thanks for reporting this. I'll check! |
how to integrate above new code of RemoveComments into my project |
@vineetha-123 Would have to wait for this PR to be merged. OR You can configure composer.json to require my fork repository. This is not very recommended, but if you are in a hurry ... {
"repositories": [
{
"type": "vcs",
"url": "https://github.com/joaorobertopb/laravel-page-speed"
}
],
"require": {
"renatomarinho/laravel-page-speed": "dev-fix-bugs-and-code-improvements"
}
} See more details: https://stackoverflow.com/questions/13498519/how-to-require-a-fork-with-composer |
thanks |
1e063e4
to
790a716
Compare
Is there any ETA when this will be merged and released? |
Sorry for the delay 😅 ! It will be merged later this year... |
@rudee24 thanks for reporting this. I'll check! |
2020 coming :D , Did u updated 💃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joaorobertopb
I have tested this PR a lot and I just found one problem with RemoveComments middleware.
It's breaking html code for "//" strings.
That would be awesome! man looking forward to this
On Thu, 13 Feb 2020 at 13:35 Lucas Mesquita Borges ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/Middleware/RemoveComments.php
<#111 (comment)>
:
> @@ -7,7 +7,8 @@ class RemoveComments extends PageSpeed
public function apply($buffer)
{
$replace = [
- '/<!--[^]><!\[](.*?)[^\]]-->/s' => ''
+ '/<!--[^]><!\[](.*?)[^\]]-->/s' => '',
+ '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\'|\")\/\/.*))/' => '',
Hi @joaorobertopb <https://github.com/joaorobertopb> I believe i'm
finishing this fix. If everything goes right, this afternoon I'll push my
commit fixing this issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#111?email_source=notifications&email_token=AD4X4XQHS32CSHN26OCV7WDRCU5BLA5CNFSM4IV54FQ2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCVMWRUA#discussion_r378832940>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD4X4XVWJCDNH2ISYK7RYG3RCU5BLANCNFSM4IV54FQQ>
.
--
*MUA N. LAURENT*: Software Engineer
Akivas Inc. <https://akivas.com/>
Akwa, Douala,CM 00237 | 174 Royal Rd, Cape Town, WC 7405, SA
Phone: (237) 670-518-086
|
any updates about the release? |
Yes @gagandeep995! We're currently working on the milestone 2.0.0 that will address this release. |
8dc9125
to
8794aaf
Compare
Merging this PR in branch 2.x |
Description
This big PR will:
Motivation and context
Why is this change required? What problem does it solve?
It fixes: #30 #46 #55 #57 #77 #82 #107 #108
The CollapseWriteSpace::class filter was producing a bug when the HTML contains inline JS comments.... All JS code after the inline comment was also commented!
For example:
After filter apply:
What is the solution?
We have to remove all inline JS comments before the 'CollapseWriteSpace' filter is executed.
🤔 ... Okay, we need to make sure RemoveComments::class filter always runs before CollapseWriteSpace::class filter!
All right, it's done:
laravel-page-speed/src/Middleware/CollapseWhitespace.php
Lines 5 to 25 in efc2f37
But...
Oooh Nooo! The RemoveComments::class filter was only removing HTML comments 🤦♂️...
Not problem ... RemoveComments::class has been updated! Now, it removes HTML, JS and CSS comments:
laravel-page-speed/src/Middleware/RemoveComments.php
Lines 5 to 16 in 332cbf6
How has this been tested?
Refactoring and improve test coverage.
Types of changes
What types of changes does your code introduce? Put an
x
in all the boxes that apply:Checklist:
I did a lot of testing and it seems to be working okay...
Can someone help me to test this PR, please? 😄
Ping @renatomarinho