mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
feat(html/minifier): Compress title (#5320)
This commit is contained in:
parent
02af4aa196
commit
6ad5b3ce5f
@ -2260,6 +2260,9 @@ impl VisitMut for Minifier<'_> {
|
||||
text_type = Some(MinifierType::Css)
|
||||
}
|
||||
}
|
||||
"title" if current_element.namespace == Namespace::HTML => {
|
||||
n.data = self.collapse_whitespace(&n.data).trim().into();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>
|
||||
|
||||
Test
|
||||
|
||||
|
||||
|
||||
|
||||
Test
|
||||
|
||||
|
||||
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>test</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
<!doctype html><html lang=en><title>Test Test</title><div>test</div>
|
@ -1,7 +1,4 @@
|
||||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>
|
||||
Document
|
||||
|
||||
</title><p>
|
||||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><p>
|
||||
test
|
||||
</p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user