Skip to content

Commit a3321ae

Browse files
committed
v2.1.1
1 parent 2828e3c commit a3321ae

30 files changed

Lines changed: 294 additions & 86 deletions

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Then modify `vite.config.ts`, like [test/vite.config.ts](test/vite.config.ts)
2525
],
2626
```
2727

28-
Then use hash history, like [test/src/router/index.ts](test/src/router/index.ts#L5)
28+
Then use hash history, like [test/src/router/index.ts](test/src/router/index.ts)
2929

3030
```diff
3131
const router = createRouter({
@@ -126,20 +126,20 @@ Preview: https://bddjr.github.io/vite-plugin-singlefile-compression/
126126

127127
```
128128
vite v8.0.0 building client environment for production...
129-
✓ 315 modules transformed.
129+
✓ 42 modules transformed.
130+
rendering chunks (1)...
130131
131-
132-
vite-plugin-singlefile-compression 2.1.0 deflate-raw
132+
vite-plugin-singlefile-compression 2.1.1 deflate-raw base128-ascii
133133
134134
file:///D:/code/js/vite-plugin-singlefile-compression/test/dist/index.html
135-
1085.847 kB -> 455.561 kB
135+
124.013 kB -> 50.35 kB
136136
137137
Finish.
138138
139139
computing gzip size...
140-
dist/index.html 455.56 kB │ gzip: 397.49 kB
140+
dist/index.html 50.35 kB │ gzip: 43.87 kB
141141
142-
✓ built in 416ms
142+
✓ built in 296ms
143143
```
144144

145145
![](effect.jpg)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vite-plugin-singlefile-compression",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"author": "bddjr",
55
"license": "MIT",
66
"description": "Compress all assets and embeds them into dist/index.html, making it convenient to share as a single HTML file.",

src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ async function generateBundle(bundle: OutputBundle, config: ResolvedConfig, opti
7777
pc.reset('\n\n') +
7878
pc.cyan('vite-plugin-singlefile-compression ' + version) +
7979
' ' +
80-
(options.enableCompress ? pc.green(options.compressFormat) : pc.red('disable compress'))
80+
(options.enableCompress
81+
? pc.green(options.compressFormat + ' ' + (
82+
options.useBase128
83+
? 'base128-ascii'
84+
: 'base64'
85+
))
86+
: pc.red('disable compress')
87+
)
8188
)
8289

8390
// rename

test/build-md.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import fs from 'fs'
2+
import markdownit from 'markdown-it'
3+
import highlightjs from 'markdown-it-highlightjs';
4+
5+
fs.rmSync('src/md-vue', { recursive: true, force: true })
6+
fs.mkdirSync('src/md-vue')
7+
8+
const md = markdownit({
9+
breaks: true,
10+
linkify: true,
11+
})
12+
13+
md.use(highlightjs, {
14+
auto: false,
15+
})
16+
17+
for (const name of fs.readdirSync('src/md')) {
18+
const mdText = fs.readFileSync('src/md/' + name).toString()
19+
const html = md.render(mdText).replaceAll('<a ', '<a target="_blank" ')
20+
const vue = '<template>\n' + html + '\n</template>'
21+
fs.writeFileSync('src/md-vue/' + name.replace(/\.md$/i, '.vue'), vue)
22+
}

test/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
55
<!-- <link rel="icon" href="/src/assets/logo.svg"> -->
6-
<link rel="icon" href="/favicon.ico">
6+
<link rel="icon" href="/favicon.svg">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<title>vite-plugin-singlefile-compression</title>
99
</head>

test/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "run-p type-check \"build-only {@}\" --",
8+
"build": "node build-md.mjs && run-p type-check \"build-only {@}\" --",
99
"preview": "vite preview",
1010
"build-only": "vite build",
1111
"type-check": "vue-tsc --build --force"

test/public/favicon.ico

-4.19 KB
Binary file not shown.

test/public/favicon.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)