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 18, 2022
1 parent 23e27a9 commit 46eaedf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/swc_css_minifier/src/compressor/color.rs
Expand Up @@ -151,8 +151,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 @@ -436,3 +436,8 @@
color: #123f;
color: #123abcff;
}

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

0 comments on commit 46eaedf

Please sign in to comment.