Skip to content

Commit

Permalink
fix(css/minifier): fix bug with modern hash
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 15, 2022
1 parent fc6ed6b commit 56c60c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion crates/swc_css_minifier/src/compressor/color.rs
Expand Up @@ -130,8 +130,9 @@ macro_rules! make_color {
let is_alpha_hex_supported = false;

if is_alpha_hex_supported {
let alpha = (($a * 255.0) as f64).round().max(0.0).min(255.0) as u8;
let hex: u32 =
((r as u32) << 24) | ((g as u32) << 16) | ((b as u32) << 8) | ($a as u32);
((r as u32) << 24) | ((g as u32) << 16) | ((b as u32) << 8) | (alpha as u32);

let compact = get_short_hex(hex);
let value = if hex == get_long_hex(compact) {
Expand Down
Expand Up @@ -428,4 +428,9 @@
.color {
color: #ff0000;
color: #FF0000;
}
}

.a {
color: hsl(270, 100%, 50%, 50%);
background: hsl(270, 100%, 50%, 0.5);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 56c60c1

Please sign in to comment.