feat(other): command dev-prod (#260)

* compress images using `vuepress-plugin-imagemin

compress all images using imagemin plugin

* updated vuepress-plugin-imagemin to 0.1.2

* command: dev-prod

adds a new command `npm run dev-prod` which build the project and then
spins up a http server. This was implemented to be able to test certain
scenarious like image compression.
This commit is contained in:
Ulf Gebhardt 2025-03-11 22:47:41 +01:00 committed by GitHub
parent aaa5c48cf4
commit d77479beda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4761 additions and 23 deletions

View File

@ -1,4 +1,5 @@
import { viteBundler } from '@vuepress/bundler-vite'
import Imagemin from 'vuepress-plugin-imagemin'
import { defineUserConfig } from 'vuepress'
import meta from './config/meta'
import theme from './config/theme'
@ -8,4 +9,34 @@ export default defineUserConfig({
...meta,
theme,
bundler: viteBundler({}),
plugins: [
Imagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpeg: {
quality: 20,
},
pngquant: {
quality: [0.8, 0.9],
speed: 4,
},
svgo: {
plugins: [
{
name: 'removeViewBox',
},
{
name: 'removeEmptyAttrs',
active: false,
},
],
},
}),
],
})

4750
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
"scripts": {
"build": "vuepress build docs",
"dev": "vuepress dev docs",
"dev-prod": "npm run build && http-server ./docs/.vuepress/dist",
"test": "textlint \"*.md\" \"docs/**/*.md\""
},
"repository": {
@ -22,6 +23,7 @@
"@textlint-rule/textlint-rule-no-unmatched-pair": "^2.0.4",
"@vuepress/bundler-vite": "^2.0.0-rc.20",
"@vuepress/plugin-slimsearch": "^2.0.0-rc.82",
"http-server": "^14.1.1",
"textlint": "^14.4.2",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-apostrophe": "^3.0.0",
@ -37,6 +39,7 @@
"textlint-rule-period-in-list-item": "^1.0.1",
"textlint-rule-write-good": "^2.0.0",
"vuepress": "^2.0.0-rc.20",
"vuepress-plugin-imagemin": "^0.1.2",
"vuepress-theme-hope": "^2.0.0-rc.74"
}
}