Skip to content

Commit

Permalink
feat: 移除前端gifsicle和vite-plugin-imagemin
Browse files Browse the repository at this point in the history
  • Loading branch information
WangJunZzz committed Sep 19, 2023
1 parent 9777fed commit 40ef076
Show file tree
Hide file tree
Showing 27 changed files with 144 additions and 41,401 deletions.
20 changes: 0 additions & 20 deletions templates/abp-vnext-pro-nuget-all/Delete-BIN-OBJ-Folders.bat

This file was deleted.

13 changes: 0 additions & 13 deletions templates/abp-vnext-pro-nuget-all/deploy.bat

This file was deleted.

59 changes: 0 additions & 59 deletions templates/abp-vnext-pro-nuget-all/docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion templates/abp-vnext-pro-nuget-all/vben28/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX=

# Whether to enable image compression
VITE_USE_IMAGEMIN= true
VITE_USE_IMAGEMIN= false

# use pwa
VITE_USE_PWA = false
Expand Down
2 changes: 1 addition & 1 deletion templates/abp-vnext-pro-nuget-all/vben28/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX=

# Whether to enable image compression
VITE_USE_IMAGEMIN= true
VITE_USE_IMAGEMIN= false

# use pwa
VITE_USE_PWA = false
Expand Down
21 changes: 15 additions & 6 deletions templates/abp-vnext-pro-nuget-all/vben28/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM nginx:1.17.3-alpine as base
EXPOSE 80
FROM node:16-alpine as build-stage
WORKDIR /app
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384

RUN npm install pnpm -g
RUN pnpm i
RUN npm run build

COPY /_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /_nginx/env.js /etc/nginx/env.js
COPY /_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY /dist/ /usr/share/nginx/html

FROM nginx:1.17.3-alpine as production-stage
COPY --from=build-stage app/_nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build-stage app/_nginx/env.js /etc/nginx/env.js
COPY --from=build-stage app/_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage app/dist/ /usr/share/nginx/html
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
// Image resource files used to compress the output of the production environment
// https://github.com/anncwb/vite-plugin-imagemin
import viteImagemin from 'vite-plugin-imagemin';
// // Image resource files used to compress the output of the production environment
// // https://github.com/anncwb/vite-plugin-imagemin
// import viteImagemin from 'vite-plugin-imagemin';

export function configImageminPlugin() {
const plugin = viteImagemin({
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,
},
],
},
});
return plugin;
}
// export function configImageminPlugin() {
// const plugin = viteImagemin({
// 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,
// },
// ],
// },
// });
// return plugin;
// }
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// The following plugins only work in the production environment
if (isBuild) {
// vite-plugin-imagemin
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());

// rollup-plugin-gzip
vitePlugins.push(
Expand Down
4 changes: 1 addition & 3 deletions templates/abp-vnext-pro-nuget-all/vben28/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
"vite": "^2.9.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mkcert": "^1.6.0",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.8.1",
Expand All @@ -150,8 +149,7 @@
},
"resolutions": {
"bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3",
"gifsicle": "5.2.0"
"rollup": "^2.56.3"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 40ef076

Please sign in to comment.