Closed MaxmaxmaximusAWS closed 3 years ago
For images we prepare https://github.com/webpack-contrib/image-minimizer-webpack-plugin (release will be on this week), after this we will implement json-minizer-webpack-plugin
for compressing json assets, this questions is not related to favicons
package directory
@evilebottnawi Regarding, my question is not related to image compression and json compression. My question is related to: why does the "favicons" package NOT compress json and does NOT compress images? The site https://gtmetrix.com lowers my points for only two things, the logos created by the "favicons" library and "manifest.json" created by the "favicons" library. That's why I wrote here.
Please reopen the issue and let's think about how to compress the output files produced by the "favicons" library. And also how to give assets name by pattern name-[hash].ext
for forever caching e.t.c.
Maybe we should write some kind of special "favicons" integration for webpack (after all, the one we have now doesn't use the loaders of webpack system) What do you think?
You can use imagemin
for this, it is out of scope package, we just a generator
@evilebottnawi don't you want to make a webpack plugin?
@MaxmaxmaximusAWS We already doing it https://github.com/webpack-contrib/image-minimizer-webpack-plugin
@evilebottnawi We are not talking about image compression, and we are not talking about json compression. We are talking about the GENERATION of images, and the GENERATION of mainfest.json, which will THEN go to webpack assets and then people will decide what to do with them =)
No favicons and webpack integrations exist right now. (And the integration that is, it does not add generated images and manifest.json to webpack assets, and therefore webpack loaders will not be applied to what generates favicons, and not minify them)
You need to create a new, deeply integrated WebpackFaviconsPlugin, or even better WebpackPWAPlugin.
Do you understand what I mean?) If you do not understand what I mean, then I will just write this plugin myself, but I think you have more experience with this.
P.S. also https://www.npmjs.com/package/imagemin-webpack-plugin P.P.S. also https://www.npmjs.com/package/image-webpack-loader using Imagemin by default =)
No caches and persistent caches, very slow + you can't minify embedded images (url-loader
) + deps are hardcoded
No compressed assets if you using copy-webpack-plugin
+ no caches and persistent cache + deps are hardcoded
Do you search https://github.com/jantimon/favicons-webpack-plugin?
@evilebottnawi Do you search https://github.com/jantimon/favicons-webpack-plugin?
Он является просто оберткой над вот этим вашем пакетом "favicons", и не добавляет ни какую интеграцию с webwpack системой лоадеров. Все мои картинки и все мои json имеют лоадеры и сжимаются, но картинки и manifest.json сгенерированные favicons-webpack-plugin
не пропупскаются через систему webpack полноценно, а записыываются как файлы напрямую, в указанную директорию, =) я по этому и обратился к вам с предложением, может запилим нормаьный WebpackPWA генератор? Который и иконки генерирует и манифест, и глубоко интегрируется с вебпаком? Как ни странно, ни одного нормального такого плагина нет еще. При чем чтоб имя можно было задавать типа filename: "manifest.[hash].json"
и потом nginx'ом указывать вечное кэширование файла, и.т.п. И прочие плюшки.
Простите что на русском
@MaxmaxmaximusAWS Да, судя по всему это хорошая идея, нашел еще https://github.com/arthurbergmz/webpack-pwa-manifest, но он не использует текущий пакет, мы можем начать это, я вижу только положительные стороны этого плагина
Честно говоря я бы даже положил его webpack-contrib
и сделал официальный решением, возможно нам потребуется небольшая работа здесь тоже, например кэширование
By the way about "how to compress manifest.json", like this: https://www.npmjs.com/package/minify-json-webpack-plugin just wrote =)
Images minify by imagemin-webpack-plugin
, by the way it uses the cache if we set option.
You just need this plugins to come after the plugin that generates the icons =)
How to minify manifest.json file and optimize logo image with webpack loader? how to give assets name by pattern
name-[hash].ext
for forever caching?