Skip to content

Commit

Permalink
fix svgo style miss
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaoboy committed Oct 19, 2024
1 parent c7cd6bf commit 31100c7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ html-escape = "0.2"
base64 = "0.22.1"
wasm-bindgen-test = "0.3.45"
ansi2 = { path = "./ansi2", features = ["wasm"] }
osvg = { version = "0.1.1", features = ["bindgen"] }
osvg = { version = "0.1.3", features = ["bindgen"] }
insta = { version = "1.40.0" }

[profile.release]
Expand Down
15 changes: 14 additions & 1 deletion ansi2-wasm/src-ts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,20 @@ async function main() {
options.lightBg,
options.darkBg,
)
const result = compress ? optimize(s).data : s
const result = compress
? optimize(s, {
plugins: [
{
name: "preset-default",
params: {
overrides: {
inlineStyles: false,
},
},
},
],
}).data
: s
process.stdout.write(result)
break
}
Expand Down
20 changes: 19 additions & 1 deletion ansi2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,25 @@ fn main() {
Format::Svg => {
let mut svg = to_svg(s, theme, width, base64, mode, args.light_bg, args.dark_bg);
if args.compress {
svg = osvg::osvg(&svg).expect("compress error");
svg = osvg::osvg(
&svg,
Some(
r#"
{
plugins: [
{
name: "preset-default",
params: {
overrides: {
inlineStyles: false,
},
},
},
],
}"#,
),
)
.expect("compress error");
}
svg
}
Expand Down
2 changes: 1 addition & 1 deletion assets/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

for i in win11 vitest 8bit-color 24bit-color nu-ls
do
cat "$i.ans" | node ../ansi2-wasm/bin/cli.js > "$i.svg"
cat "$i.ans" | node ../ansi2-wasm/bin/cli.js -c > "$i.svg"
cat "$i.ans" | node ../ansi2-wasm/bin/cli.js --mode=light -c > "$i-light.svg"
cat "$i.ans" | node ../ansi2-wasm/bin/cli.js --mode=dark -c > "$i-dark.svg"
echo "$i done"
Expand Down

0 comments on commit 31100c7

Please sign in to comment.