yireo-joomla / pkg_scriptmerge Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Hello again.
I found sometime and i am trying to find google page speed insights for a website with this plugin.
What i am getting from google is a "Laverage broswer caching" fix consideration for the css and javascript pages that are shown with 30 minutes caching time.
The settings:
Merge Type: File-list Dynamic
Hashing method: Advanced
Now what is the issue / s
I have a multy language site that requires dynamic hashing and thus these are the settings.
Since the htaccess doesnt see the .css or .js file type doesnt give these two files correct time to expire.
I tried to add the extensions manually in the plugin with no success, also this could be done perhaps via php from the components view as it gets called but i cant seem to find the view...
Any assistance / thoughts?
Edit: I tried editing the com_scriptmerge\helpers\helper.php without any results.
Hello,
I would like to expand an the dynamic css and javascript generation, an issue that causes sometimes issues with caching of the scripts and errors or can just appear page speed suggestions in various engines.
What i would like to suggest and it would be nice to have your thoughts is to develop ( i can do it ) an alternative way to output the scripts and css via inline html witch could eliminate any such problems with the only side-effect the increased html size.
It could be easily implemented obtaining backwards compatibility by introducing a new option in the "Merge Type" option about Filelist ( dynamic - Inline).
What do you think?
PS i have not taken a look in the code about the required time in order to develop such an implementation but i believe it would not be so hard ;)
Hello,
i think it is better to state a few points here than another pull request.
First of all for the record and for general understanding the way the plugin works for images is that the function getImgMatches now( with the latest commit) gets all image sources, validates their write functionality and pushed them into an array with their respective width and height.
This array is used on the function onAfterRender that for the time being with the check isEnabledImg and each image source is replaced within the doc with str_replace function.
The issue:
Some plugins use the same image paths in multiple elements or placed that should not be replaced and thus brake the page or their functionality.
In order to solve this we may use many ways from some of them i have tested:
a) use within the str_replace an <img src= so we only target images.
The issues here are that not all of images have src attribute after img and anyway in general str_replace is not recommended for tampering with the dom.
b) The use of the $dom->loadHTML , $dom->saveHTML approach.
This way we tamper with the dom as we should but according to my tests the dom is tampered in many ways and whatever supported command i used to prevent it some javascripts broke.
In my tests one web site worked correctly while another with multiple javascripts had major issues.
So i suggest not working with this method while it is correct but it will cause significant issues.
c) Since php dom gives significance to proper html formatting and breaks some things we need a library that does not give importance to validated html.
Here comes the library: simplehtmldom* that supports tampering with html elements without the above issues. In my tests all web sites where working correctly and i am currently having one of them now live ;)
What is needed is to import the library and run 10 lines of code :)
d) Suggestion:
We could use an option in the settings and let the user choose how he would like to use the image functionality. Lets say:
Way a: old school with str_replace
Way b: Dom oriented.
That way we could support more websites and give administrators the capability to solve any technical glitches by their own.
28-1-2016 Ps. we can also make an option not to change the height and width of any image if it has already been set...
I can provide a latest demo with the changes if you wish.
I will be waiting for your opinion and thoughts.
Edit 29-1-2016 Any thoughts?
Hello i hope me message finds you well.
I would like to state that after a generic speed opt test i found out that in the case a website may have the option"Merge Js" to No then the compress Js option is ignored and any script that is outputted is not compressed at all.
Is this a normal / intended behavior?
In my opinion compression should be set and operate with and without script merging both on the merged scripts and on each script that is not merged separately.
You may test any website using the google page speed tool:
https://developers.google.com/speed/pagespeed/insights/
You will notice the scripts are outputted with the same level of compression always.
What would you think if we would implement support to automate the creation of css above the fold content? I can see there is a library that will do: https://github.com/pocketjoso/penthouse
Many wordpress plugins exist for that use too. I believe only one plugin (not open source) supports this in joomla platform.
I would like your thoughts :)
Hello,
Regarding the option Compress CSS through using CSSmin i have to say that for all the websites i have used so far they all break the css in an important factor. I did check in the forum and saw the whole consent has started since 2013 and the plugin is in the latest version 3.0.1 but it has not been updated since 2011.
There seems to be a small issue in the preload header generation, an extra / is added after the domain, causing the browser to treat the same merged CSS as two different sources.
The extra / in the preload header causes Chrome to preload it, but then re-download since it thinks the url in the html is different, hence it also gives this warning:
I think this shouldn't be too hard of a fix right?
Above warning
Reason:
$this->getArrayFromParam('exclude_menuitems');
results in an array. Field exclude_menuitems is a multiple one.
See
private function getArrayFromParam($param)
{
$data = $this->params->get($param);
$data = trim($data);
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.