remove img uploader

This commit is contained in:
Kseninia Mikhaylova 2024-06-21 15:53:07 +03:00
parent 9e4451f2fa
commit 6b2d8b4400
3 changed files with 26 additions and 35 deletions

View File

@ -6,32 +6,32 @@ 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}`))
}
}
}
}
}
// '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}`))
// }
// }
// }
// }
// }
},
app: {
pageTransition: { name: 'page', mode: 'out-in' },

7
package-lock.json generated
View File

@ -15,7 +15,6 @@
"@tresjs/cientos": "^3.9.0",
"@tresjs/core": "^4.0.2",
"@tresjs/nuxt": "^2.1.2",
"glob": "^10.4.2",
"imagemin": "^9.0.0",
"imagemin-pngquant": "^10.0.0",
"marked": "^12.0.2",
@ -23,7 +22,6 @@
"nuxt-anchorscroll": "^1.0.3",
"nuxt-icon": "^0.6.10",
"nuxt-svgo": "^4.0.1",
"ral-hex-converter": "^1.0.1",
"sass": "^1.77.4",
"tailwindcss": "^3.4.3",
"three": "^0.165.0",
@ -13646,11 +13644,6 @@
"resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz",
"integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA=="
},
"node_modules/ral-hex-converter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ral-hex-converter/-/ral-hex-converter-1.0.1.tgz",
"integrity": "sha512-A0C1KzDyUzKRgLLVBmjFmPKnkkq7VvgL6MszNxkPuH6AlFfr6zdEYdWvDWw4tChWql7OAcOOgUvF8wVueopTFg=="
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",

View File

@ -18,8 +18,6 @@
"@tresjs/cientos": "^3.9.0",
"@tresjs/core": "^4.0.2",
"@tresjs/nuxt": "^2.1.2",
"imagemin": "^9.0.0",
"imagemin-pngquant": "^10.0.0",
"marked": "^12.0.2",
"nuxt": "^3.11.2",
"nuxt-anchorscroll": "^1.0.3",