Skip to content

Commit

Permalink
1.1.4 README
Browse files Browse the repository at this point in the history
  • Loading branch information
bddjr committed Dec 30, 2024
1 parent 7e238b2 commit 026a0fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 35 deletions.
16 changes: 6 additions & 10 deletions README-zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vite plugin singlefile compression

该插件使用 gzip 将所有 JavaScript、CSS、图片等资源压缩后,嵌入到 `dist/index.html` ,方便作为单个 HTML 文件分享。
使用 gzip 将所有资源压缩后,嵌入到 `dist/index.html` ,方便作为单个 HTML 文件分享。

接收方可以直接使用浏览器打开,无需手动解压文件。

Expand Down Expand Up @@ -97,23 +97,19 @@ export interface Options {
https://bddjr.github.io/vite-plugin-singlefile-compression/
```
vite v5.4.11 building for production...
vite v6.0.6 building for production...
45 modules transformed.
rendering chunks (1)...

vite-plugin-singlefile-compression 1.1.0 building...
vite-plugin-singlefile-compression 1.1.3 building...

file:///D:/bddjr/Desktop/code/js/vite-plugin-singlefile-compression/test/dist/index.html
101.43 KiB -> 52.35 KiB
101.02 KiB -> 52.1 KiB

Finish.

dist/index.html 53.60 kB
built in 678ms
```
```html
<!DOCTYPE html><meta charset=UTF-8><link rel=icon href=data:><meta name=viewport content="width=device-width,initial-scale=1"><title>Vite App</title><script type=module>fetch("data:application/gzip;base64,********").then(r=>r.blob()).then(b=>new Response(b.stream().pipeThrough(new DecompressionStream("gzip")),{headers:{"Content-Type":"text/javascript"}}).blob()).then(b=>import(b=URL.createObjectURL(b)).finally(()=>URL.revokeObjectURL(b)))</script><div id=app></div>
dist/index.html 53.35 kB
built in 734ms
```
## Clone
Expand Down
30 changes: 5 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,39 +97,19 @@ export interface Options {
https://bddjr.github.io/vite-plugin-singlefile-compression/
```
vite v5.4.11 building for production...
vite v6.0.6 building for production...
45 modules transformed.
rendering chunks (1)...

vite-plugin-singlefile-compression 1.1.0 building...
vite-plugin-singlefile-compression 1.1.3 building...

file:///D:/bddjr/Desktop/code/js/vite-plugin-singlefile-compression/test/dist/index.html
101.43 KiB -> 52.35 KiB
101.02 KiB -> 52.1 KiB

Finish.

dist/index.html 53.60 kB
built in 678ms
```
```html
<!DOCTYPE html><meta charset="UTF-8" /><link rel="icon" href="data:" /><meta
name="viewport"
content="width=device-width,initial-scale=1"
/><title>Vite App</title>
<script type="module">
fetch("data:application/gzip;base64,********")
.then((r) => r.blob())
.then((b) =>
new Response(b.stream().pipeThrough(new DecompressionStream("gzip")), {
headers: { "Content-Type": "text/javascript" },
}).blob()
)
.then((b) =>
import((b = URL.createObjectURL(b))).finally(() => URL.revokeObjectURL(b))
);
</script>
<div id="app"></div>
dist/index.html 53.35 kB
built in 734ms
```
## Clone
Expand Down

0 comments on commit 026a0fc

Please sign in to comment.