We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 928d14b commit e6baae5Copy full SHA for e6baae5
src/librustdoc/html/static_files.rs
@@ -19,9 +19,13 @@ impl StaticFile {
19
}
20
21
pub(crate) fn minified(&self) -> Vec<u8> {
22
- if self.filename.ends_with(".css") {
+ let extension = match self.filename.extension() {
23
+ Some(e) => e,
24
+ None => return self.bytes.to_owned(),
25
+ };
26
+ if extension == "css" {
27
minifier::css::minify(str::from_utf8(self.bytes).unwrap()).unwrap().to_string().into()
- } else if self.filename.ends_with(".js") {
28
+ } else if extension == "js" {
29
minifier::js::minify(str::from_utf8(self.bytes).unwrap()).to_string().into()
30
} else {
31
self.bytes.to_owned()
0 commit comments