Skip to content

Commit e6baae5

Browse files
Fix missing minification for static files
1 parent 928d14b commit e6baae5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustdoc/html/static_files.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ impl StaticFile {
1919
}
2020

2121
pub(crate) fn minified(&self) -> Vec<u8> {
22-
if self.filename.ends_with(".css") {
22+
let extension = match self.filename.extension() {
23+
Some(e) => e,
24+
None => return self.bytes.to_owned(),
25+
};
26+
if extension == "css" {
2327
minifier::css::minify(str::from_utf8(self.bytes).unwrap()).unwrap().to_string().into()
24-
} else if self.filename.ends_with(".js") {
28+
} else if extension == "js" {
2529
minifier::js::minify(str::from_utf8(self.bytes).unwrap()).to_string().into()
2630
} else {
2731
self.bytes.to_owned()

0 commit comments

Comments
 (0)