-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html/minifier): Allow compressing additional attributes (#5036)
- Loading branch information
1 parent
8b04274
commit 55e0ea3
Showing
5 changed files
with
208 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
crates/swc_html_minifier/tests/fixture/attribute/custom-attribute/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"minifyAdditionalAttributes": [ | ||
["^data-click", "js"], | ||
["^ng-", "js"], | ||
["^data-json", "json"], | ||
["^data-style", "css"], | ||
["^data-html", "html"] | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
crates/swc_html_minifier/tests/fixture/attribute/custom-attribute/input.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" | ||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<button type="button" onclick="a(1 + 2)" ng-click="a(1 + 2)" data-click="a(1 + 2)"></button> | ||
<button type="button" onclick="a(1 + 2)" ng-click="a(1 + 2)" data-click="a(1 + 2)"></button> | ||
<div data-json='{ "foo": "bar" }'></div> | ||
<div data-style="color: red; background-color: red"></div> | ||
<iframe srcdoc="<html> <body> <p>test.</p>" src="nosrcdoc.html"></iframe> | ||
<div data-html="<html> <body> <p>test.</p>" src="nosrcdoc.html"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.
55e0ea3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/minify/libraries/antd
1629261898
ns/iter (± 9160935
)1677065970
ns/iter (± 31913732
)0.97
es/full/minify/libraries/d3
400016458
ns/iter (± 4699793
)440498270
ns/iter (± 8713870
)0.91
es/full/minify/libraries/echarts
1610667988
ns/iter (± 28928933
)1670768194
ns/iter (± 26603713
)0.96
es/full/minify/libraries/jquery
87064706
ns/iter (± 1254987
)101867890
ns/iter (± 3824022
)0.85
es/full/minify/libraries/lodash
116421667
ns/iter (± 2095223
)134704731
ns/iter (± 2994713
)0.86
es/full/minify/libraries/moment
52014933
ns/iter (± 1241650
)58748746
ns/iter (± 584903
)0.89
es/full/minify/libraries/react
18367196
ns/iter (± 858627
)18886460
ns/iter (± 472592
)0.97
es/full/minify/libraries/terser
592997037
ns/iter (± 13296702
)622043344
ns/iter (± 12607014
)0.95
es/full/minify/libraries/three
542737979
ns/iter (± 3026572
)564374191
ns/iter (± 8815940
)0.96
es/full/minify/libraries/typescript
3445681172
ns/iter (± 37589007
)3589112323
ns/iter (± 55669666
)0.96
es/full/minify/libraries/victory
718145074
ns/iter (± 9571676
)752027563
ns/iter (± 4591208
)0.95
es/full/minify/libraries/vue
131031034
ns/iter (± 2736413
)159632105
ns/iter (± 2242216
)0.82
es/full/codegen/es3
32671
ns/iter (± 1363
)32746
ns/iter (± 1566
)1.00
es/full/codegen/es5
32726
ns/iter (± 670
)32687
ns/iter (± 327
)1.00
es/full/codegen/es2015
32654
ns/iter (± 1377
)32800
ns/iter (± 430
)1.00
es/full/codegen/es2016
32686
ns/iter (± 1073
)32803
ns/iter (± 457
)1.00
es/full/codegen/es2017
32526
ns/iter (± 1362
)31435
ns/iter (± 1128
)1.03
es/full/codegen/es2018
32616
ns/iter (± 1054
)32509
ns/iter (± 633
)1.00
es/full/codegen/es2019
32605
ns/iter (± 1096
)32588
ns/iter (± 1008
)1.00
es/full/codegen/es2020
32783
ns/iter (± 1490
)32636
ns/iter (± 2918
)1.00
es/full/all/es3
179259661
ns/iter (± 9822465
)190928774
ns/iter (± 8604319
)0.94
es/full/all/es5
167434061
ns/iter (± 2999797
)183280570
ns/iter (± 10559769
)0.91
es/full/all/es2015
136365286
ns/iter (± 3483988
)138355011
ns/iter (± 2970068
)0.99
es/full/all/es2016
135498835
ns/iter (± 3521091
)138789554
ns/iter (± 2610463
)0.98
es/full/all/es2017
135041208
ns/iter (± 3040354
)143210809
ns/iter (± 4899288
)0.94
es/full/all/es2018
133606034
ns/iter (± 2862796
)140842112
ns/iter (± 4017436
)0.95
es/full/all/es2019
132820617
ns/iter (± 3235566
)141347434
ns/iter (± 6586499
)0.94
es/full/all/es2020
128089391
ns/iter (± 2553936
)130775269
ns/iter (± 3371631
)0.98
es/full/parser
683380
ns/iter (± 22549
)715282
ns/iter (± 14870
)0.96
es/full/base/fixer
28809
ns/iter (± 1087
)29083
ns/iter (± 383
)0.99
es/full/base/resolver_and_hygiene
85282
ns/iter (± 2382
)87824
ns/iter (± 2768
)0.97
serialization of ast node
206
ns/iter (± 6
)207
ns/iter (± 7
)1.00
serialization of serde
215
ns/iter (± 10
)217
ns/iter (± 1
)0.99
This comment was automatically generated by workflow using github-action-benchmark.