add pkg and remove png hook #48
|
@ -4,10 +4,10 @@ services:
|
|||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
# env_file: ".env"
|
||||
container_name: mns_mini_zabor_${BRANCH}
|
||||
container_name: mns_mini_zabor_${BRANCH:-dev}
|
||||
restart: always
|
||||
ports:
|
||||
- "${DOCKER_PORT}:3000"
|
||||
- "${DOCKER_PORT:-80}:3000"
|
||||
volumes:
|
||||
- ./.env:/src/.env
|
||||
image: ci.svs-tech.pro/mns-mini-zabor:$BRANCH
|
||||
image: ci.svs-tech.pro/mns-mini-zabor:${BRANCH:-dev}
|
||||
|
|
|
@ -1,38 +1,7 @@
|
|||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
import fs from 'fs/promises'
|
||||
import chalk from 'chalk';
|
||||
import imagemin from 'imagemin';
|
||||
import imageminPngquant from 'imagemin-pngquant';
|
||||
|
||||
export default defineNuxtConfig({
|
||||
hooks: {
|
||||
'nitro:build:public-assets': async (nitro) => {
|
||||
console.log(`😈 custom hook imagemin in ${nitro.options.output.publicDir}`)
|
||||
const output_path = nitro.options.output.publicDir
|
||||
const filelist = await fs.readdir(output_path, { recursive: true });
|
||||
for (let index = 0; index < filelist.length; index++) {
|
||||
const element = filelist[index];
|
||||
const elementFile = await fs.lstat(`${output_path}/${element}`)
|
||||
if (element.startsWith('_nuxt')) continue
|
||||
if (elementFile.isFile()) {
|
||||
if (element.endsWith('.png')) {
|
||||
const dest = `${output_path}/${element.split('/').slice(0, -1).join('/')}`
|
||||
const res = await imagemin([`${output_path}/${element}`], {
|
||||
destination: dest,
|
||||
plugins: [
|
||||
imageminPngquant({
|
||||
quality: [0.6, 0.8]
|
||||
})
|
||||
]
|
||||
})
|
||||
if (res.length) {
|
||||
console.log(chalk.gray(` compress PNG ${output_path}/${element}`))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
hooks: {},
|
||||
app: {
|
||||
pageTransition: { name: 'page', mode: 'out-in' },
|
||||
head: {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,8 +20,7 @@
|
|||
"@tresjs/cientos": "^3.9.0",
|
||||
"@tresjs/core": "^4.0.2",
|
||||
"@tresjs/nuxt": "^2.1.2",
|
||||
"imagemin": "^9.0.0",
|
||||
"imagemin-pngquant": "^10.0.0",
|
||||
"consola": "^3.2.3",
|
||||
"marked": "^12.0.2",
|
||||
"nuxt": "^3.11.2",
|
||||
"nuxt-icon": "^0.6.10",
|
||||
|
|
Loading…
Reference in New Issue