mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge pull request #5684 from squidfunk/refactor/polyfills
Remove polyfills for ancient browsers from bundle
This commit is contained in:
@@ -16,15 +16,15 @@ version range, please [open an issue]:
|
|||||||
|
|
||||||
<figure markdown>
|
<figure markdown>
|
||||||
|
|
||||||
| Browser | Version | Release date | | | Usage |
|
| Browser | Version[^2] | Release date | | | Usage |
|
||||||
| ------------------------------------ | ------: | -----------: | ------: | -----: | ---------: |
|
| ------------------------------------ | ----------: | -----------: | ------: | -----: | ---------: |
|
||||||
| | | | desktop | mobile | overall |
|
| | | | desktop | mobile | overall |
|
||||||
| :fontawesome-brands-chrome: Chrome | 49+ | 03/2016 | 25.65% | 38.33% | 63.98% |
|
| :fontawesome-brands-chrome: Chrome | 49+ | 03/2016 | 25.65% | 38.33% | 63.98% |
|
||||||
| :fontawesome-brands-safari: Safari | 10+ | 09/2016 | 4.63% | 14.96% | 19.59% |
|
| :fontawesome-brands-safari: Safari | 10+ | 09/2016 | 4.63% | 14.96% | 19.59% |
|
||||||
| :fontawesome-brands-edge: Edge | 79+ | 01/2020 | 3.95% | n/a | 3.95% |
|
| :fontawesome-brands-edge: Edge | 79+ | 01/2020 | 3.95% | n/a | 3.95% |
|
||||||
| :fontawesome-brands-firefox: Firefox | 53+ | 04/2017 | 3.40% | .30% | 3.70% |
|
| :fontawesome-brands-firefox: Firefox | 53+ | 04/2017 | 3.40% | .30% | 3.70% |
|
||||||
| :fontawesome-brands-opera: Opera | 36+ | 03/2016 | 1.44% | .01% | 1.45% |
|
| :fontawesome-brands-opera: Opera | 36+ | 03/2016 | 1.44% | .01% | 1.45% |
|
||||||
| | | | | | __92.67%__ |
|
| | | | | | __92.67%__ |
|
||||||
|
|
||||||
<figcaption markdown>
|
<figcaption markdown>
|
||||||
|
|
||||||
@@ -40,6 +40,23 @@ Browser support matrix sourced from [caniuse.com].[^1]
|
|||||||
cumulated market share of less than 1% were not considered, but might still
|
cumulated market share of less than 1% were not considered, but might still
|
||||||
be fully or partially supported.
|
be fully or partially supported.
|
||||||
|
|
||||||
|
[^2]:
|
||||||
|
In Material for MkDocs 9.2.0, polyfills for ancient browsers were removed,
|
||||||
|
so make sure to add them back if you need to support the full version
|
||||||
|
range as mentioned in the [browser support] matrix. Add the following
|
||||||
|
lines to `mkdocs.yml`:
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
config:
|
||||||
|
extra:
|
||||||
|
polyfills:
|
||||||
|
- https://unpkg.com/resize-observer-polyfill
|
||||||
|
- https://unpkg.com/array-flat-polyfill
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also download the files and self-host them, or use the
|
||||||
|
[built-in privacy plugin] to do it automatically.
|
||||||
|
|
||||||
Note that the usage data is based on global browser market share, so it could
|
Note that the usage data is based on global browser market share, so it could
|
||||||
in fact be entirely different for your target demographic. It's a good idea to
|
in fact be entirely different for your target demographic. It's a good idea to
|
||||||
check the distribution of browser types and versions among your users.
|
check the distribution of browser types and versions among your users.
|
||||||
@@ -47,6 +64,8 @@ check the distribution of browser types and versions among your users.
|
|||||||
[open an issue]: https://github.com/squidfunk/mkdocs-material/issues/new/choose
|
[open an issue]: https://github.com/squidfunk/mkdocs-material/issues/new/choose
|
||||||
[caniuse.com]: https://caniuse.com/
|
[caniuse.com]: https://caniuse.com/
|
||||||
[:is pseudo selector]: https://caniuse.com/css-matches-pseudo
|
[:is pseudo selector]: https://caniuse.com/css-matches-pseudo
|
||||||
|
[browser support]: #supported-browsers
|
||||||
|
[built-in privacy plugin]: setup/ensuring-data-privacy.md#built-in-privacy-plugin
|
||||||
|
|
||||||
## Other browsers
|
## Other browsers
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
18
material/.overrides/assets/javascripts/custom.99dda5c2.min.js
vendored
Normal file
18
material/.overrides/assets/javascripts/custom.99dda5c2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -23,5 +23,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'assets/javascripts/custom.98e0b405.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/custom.99dda5c2.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
29
material/assets/javascripts/bundle.f11ae8b1.min.js
vendored
Normal file
29
material/assets/javascripts/bundle.f11ae8b1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
material/assets/javascripts/bundle.f11ae8b1.min.js.map
Normal file
8
material/assets/javascripts/bundle.f11ae8b1.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -51,7 +51,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% include "partials/icons.html" %}
|
{% include "partials/icons.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block libs %}{% endblock %}
|
{% block libs %}
|
||||||
|
{% for path in config.extra.polyfills %}
|
||||||
|
<script src="{{ path | url }}"></script>
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
{% block fonts %}
|
{% block fonts %}
|
||||||
{% if config.theme.font != false %}
|
{% if config.theme.font != false %}
|
||||||
{% set text = config.theme.font.text | d("Roboto", true) %}
|
{% set text = config.theme.font.text | d("Roboto", true) %}
|
||||||
@@ -244,7 +248,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.d7db711e.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.f11ae8b1.min.js' | url }}"></script>
|
||||||
{% for path in config.extra_javascript %}
|
{% for path in config.extra_javascript %}
|
||||||
{% if path.endswith(".mjs") %}
|
{% if path.endswith(".mjs") %}
|
||||||
<script type="module" src="{{ path | url }}"></script>
|
<script type="module" src="{{ path | url }}"></script>
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ class OfflinePlugin(BasePlugin[OfflineConfig]):
|
|||||||
# Ensure correct resolution of links
|
# Ensure correct resolution of links
|
||||||
config.use_directory_urls = False
|
config.use_directory_urls = False
|
||||||
|
|
||||||
|
# Append iframe-worker to polyfills/shims
|
||||||
|
config.extra.polyfills = config.extra.get("polyfills", [])
|
||||||
|
if not any("iframe-worker" in url for url in config.extra.polyfills):
|
||||||
|
worker = "https://unpkg.com/iframe-worker/shim"
|
||||||
|
config.extra.polyfills.append(worker)
|
||||||
|
|
||||||
# Support offline search (run latest)
|
# Support offline search (run latest)
|
||||||
@event_priority(-100)
|
@event_priority(-100)
|
||||||
def on_post_build(self, *, config):
|
def on_post_build(self, *, config):
|
||||||
|
|||||||
@@ -39,18 +39,13 @@
|
|||||||
"upgrade:install": "npm install"
|
"upgrade:install": "npm install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array-flat-polyfill": "^1.0.1",
|
|
||||||
"clipboard": "^2.0.11",
|
"clipboard": "^2.0.11",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"focus-visible": "^5.2.0",
|
"focus-visible": "^5.2.0",
|
||||||
"fuzzaldrin-plus": "^0.6.0",
|
"fuzzaldrin-plus": "^0.6.0",
|
||||||
"iframe-worker": "^1.0.3",
|
|
||||||
"lunr": "^2.3.9",
|
"lunr": "^2.3.9",
|
||||||
"lunr-languages": "^1.12.0",
|
"lunr-languages": "^1.12.0",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"rxjs": "^7.8.1"
|
||||||
"rxjs": "^7.8.1",
|
|
||||||
"unfetch": "^5.0.0",
|
|
||||||
"url-polyfill": "^1.1.12"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^6.4.0",
|
"@fortawesome/fontawesome-free": "^6.4.0",
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ResizeObserver from "resize-observer-polyfill"
|
|
||||||
import {
|
import {
|
||||||
NEVER,
|
NEVER,
|
||||||
Observable,
|
Observable,
|
||||||
|
|||||||
@@ -20,11 +20,7 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "array-flat-polyfill"
|
|
||||||
import "focus-visible"
|
import "focus-visible"
|
||||||
import "iframe-worker/shim"
|
|
||||||
import "unfetch/polyfill"
|
|
||||||
import "url-polyfill"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
EMPTY,
|
EMPTY,
|
||||||
|
|||||||
@@ -115,7 +115,11 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<!-- JavaScript libraries -->
|
<!-- JavaScript libraries -->
|
||||||
{% block libs %}{% endblock %}
|
{% block libs %}
|
||||||
|
{% for path in config.extra.polyfills %}
|
||||||
|
<script src="{{ path | url }}"></script>
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<!-- Webfonts -->
|
<!-- Webfonts -->
|
||||||
{% block fonts %}
|
{% block fonts %}
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ class OfflinePlugin(BasePlugin[OfflineConfig]):
|
|||||||
# Ensure correct resolution of links
|
# Ensure correct resolution of links
|
||||||
config.use_directory_urls = False
|
config.use_directory_urls = False
|
||||||
|
|
||||||
|
# Append iframe-worker to polyfills/shims
|
||||||
|
config.extra.polyfills = config.extra.get("polyfills", [])
|
||||||
|
if not any("iframe-worker" in url for url in config.extra.polyfills):
|
||||||
|
worker = "https://unpkg.com/iframe-worker/shim"
|
||||||
|
config.extra.polyfills.append(worker)
|
||||||
|
|
||||||
# Support offline search (run latest)
|
# Support offline search (run latest)
|
||||||
@event_priority(-100)
|
@event_priority(-100)
|
||||||
def on_post_build(self, *, config):
|
def on_post_build(self, *, config):
|
||||||
|
|||||||
Reference in New Issue
Block a user