litespeedtech / litespeedtech/lscache_wp
"JS Optimization" and "Load JS Deferred" complication
- Dominant language
- PHP
- Stars
- 257
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
On "Tuning" panel, there is a "JS Excludes" section, where the info says:
- Listed files or inline JS code will not be minified/combined
- Elements with attribute `data-no-optimize` will be excluded
- Filter `litespeed_optimize_js_excludes` is supported.
This has nothing to do with "Deferred JS", right? Not really.
In [_parse_js](https://github.com/litespeedtech/lscache_wp/blob/v7.2/src/optimize.cls.php#L851) when we [loop through](https://github.com/litespeedtech/lscache_wp/blob/v7.2/src/optimize.cls.php#L866) the scripts, it [skips the current](https://github.com/litespeedtech/lscache_wp/blob/v7.2/src/optimize.cls.php#L872-L874) item if it has the `data-no-optimize` tag, so that script will NOT be [deferred/delayed](https://github.com/litespeedtech/lscache_wp/blob/v7.2/src/optimize.cls.php#L898) either! So one would guess, when a script is excluded from "Optimization", it will not be deferred either. Which would even make sense, but when we add an other script with `litespeed_optimize_js_excludes` to skip optimization, it will still be deferred (as intended).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/optimize.cls.php at _parse_js and the referenced script loop, especially the data-no-optimize skip and deferred/delayed handling around the cited lines. Compare that path with scripts excluded through litespeed_optimize_js_excludes, then establish and implement consistent behavior for optimization exclusions versus deferred JavaScript; done means both exclusion mechanisms follow the documented, agreed semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100