Comments (9)
I should take this as having a green light to go ahead and implement this, right... having an implementation suggestion from mjangda which I'm OK to move forward with anyways.
I have some time for some contributions, and would definitely prefer to spend it on items which can speed up websites.
from nginx-http-concat.
I guess we're missing a matching version of the ngx_http_concat_style_loader_tag
filter for javascript.
from nginx-http-concat.
Thanks @mjangda. That makes sense. Would updating https://github.com/Automattic/nginx-http-concat/blob/master/jsconcat.php#L161 to something like below be acceptable?
$tag = "<script type='text/javascript' src='$href'></script>\n";
echo apply_filters( 'ngx_http_concat_script_loader_tag', $tag, $href );
from nginx-http-concat.
The solution might need to be more robust than that. The async
and defer
attributes should be able to be set on the enqueued asset and then the concat utility would group them. Otherwise, you might end up async
or defer
ing a script which, for one reason or another, needs to be loaded synchronously. Groups could be leveraged for this, though they're a bit clunky.
Also relevant: https://core.trac.wordpress.org/ticket/22249
from nginx-http-concat.
Yeah, might be good to have this built-in to the plugin using an approach like this: https://gist.github.com/georgestephanis/2a84bc55ad23f4dec2cf2464109add59
That way, all sites have to worry about is called wp_script_add_data
.
from nginx-http-concat.
We hit this snag ourselves. All of the JS assets that we do not want to be render-blocking because we want a site render fast ends up slowing down the paint on production because the concatenation doesn't cater for defers.
@mjangda - would it be a good investment of my time if I went in and went forward with your suggestion from Jul 27 and come back with a PR?
If you already have this in the pipeline, at least let me know when it's expected to come through, and whether there's anything else I can help with to get it moving forward.
from nginx-http-concat.
If you already have this in the pipeline, at least let me know when it's expected to come through
Nothing currently in the pipeline.
from nginx-http-concat.
@mboynes I've refreshed https://core.trac.wordpress.org/ticket/22249 you've referenced above and also tested it. It contains good work, hope it will eventually move forward and get merged in.
I'm going to get accommodated to concat groups now and see how a solution can start to shape up.
from nginx-http-concat.
WordPress 6.3 added support for defer
and async
to the wp_register_script
function:
https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/
If possible we should use the strategy
value of the registered script to determine the strategy. It could be used in combination with #36 which adds a filter, we could check for the values and if present add them to the filter dynamically.
from nginx-http-concat.
Related Issues (20)
- Add support for conditional extras
- Properly handle inline scripts
- Pass unique and relevant $handle to style_loader_tag filter HOT 2
- External scripts are not enqueued with necessary dependencies
- Multisite (subfolders) doesn't work. HOT 1
- Assets that skip concatenation should still get an `mtime`
- SVG inside CSS can be inadvertently altered by concat code HOT 2
- ini_get ALWAYS returns a string HOT 1
- When WP_CONTENT_DIR is changed WPCOM_Concat_Utils::realpath fails HOT 1
- When a group is enqueued, localized scripts are missed HOT 1
- Group common scripts
- How to install this HOT 2
- Bug in concatenation
- Skip concat if logged in as admin HOT 2
- Bug with wp_add_inline_script
- Concatenation should be disable during script debugging
- Gutenberg's `register_block_style()` not working due to concatenation HOT 1
- Duplicate ID defined in some instances
- Deprecated: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx-http-concat.