Skip to content

Commit

Permalink
Fix missing minification for static files
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 14, 2022
1 parent 928d14b commit e6baae5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ impl StaticFile {
}

pub(crate) fn minified(&self) -> Vec<u8> {
if self.filename.ends_with(".css") {
let extension = match self.filename.extension() {
Some(e) => e,
None => return self.bytes.to_owned(),
};
if extension == "css" {
minifier::css::minify(str::from_utf8(self.bytes).unwrap()).unwrap().to_string().into()
} else if self.filename.ends_with(".js") {
} else if extension == "js" {
minifier::js::minify(str::from_utf8(self.bytes).unwrap()).to_string().into()
} else {
self.bytes.to_owned()
Expand Down

0 comments on commit e6baae5

Please sign in to comment.