mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
feat(html/minifier): Compress more json content (#4684)
This commit is contained in:
parent
9a027ba7c2
commit
3aac28e9df
@ -325,7 +325,10 @@ impl VisitMut for Minifier {
|
||||
&& n.attributes.iter().any(|attribute| match &*attribute.name {
|
||||
"type"
|
||||
if attribute.value.is_some()
|
||||
&& (&*attribute.value.as_ref().unwrap()) == "application/ld+json" =>
|
||||
&& matches!(
|
||||
&**attribute.value.as_ref().unwrap(),
|
||||
"application/ld+json" | "importmap" | "speculationrules"
|
||||
) =>
|
||||
{
|
||||
true
|
||||
}
|
||||
|
@ -48,6 +48,31 @@
|
||||
"prepTime": "PT20M"
|
||||
}
|
||||
</script>
|
||||
<script type="speculationrules">
|
||||
{
|
||||
"prerender": [
|
||||
{
|
||||
"source": "list",
|
||||
"urls": ["/page/2"],
|
||||
"score": 0.5
|
||||
},
|
||||
{
|
||||
"source": "document",
|
||||
"if_href_matches": ["https://*.wikipedia.org/**"],
|
||||
"if_not_selector_matches": [".restricted-section *"],
|
||||
"score": 0.1
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"moment": "/node_modules/moment/src/moment.js",
|
||||
"lodash": "/node_modules/lodash-es/lodash.js"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Party coffee cake recipe</h2>
|
||||
|
@ -20,6 +20,8 @@
|
||||
"prepTime": "PT20M"
|
||||
}
|
||||
</script>
|
||||
<script type=speculationrules>{"prerender":[{"score":0.5,"source":"list","urls":["/page/2"]},{"if_href_matches":["https://*.wikipedia.org/**"],"if_not_selector_matches":[".restricted-section *"],"score":0.1,"source":"document"}]}</script>
|
||||
<script type=importmap>{"imports":{"lodash":"/node_modules/lodash-es/lodash.js","moment":"/node_modules/moment/src/moment.js"}}</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Party coffee cake recipe</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user