Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@bazzite/nuxt-optimized-images
Advanced tools
Automatically optimizes images used in Nuxt.js projects (jpeg, png, svg, webp and gif).
Automatically optimizes images used in Nuxt.js projects (JPEG, PNG, SVG, WebP and GIF).
This module is inspired by the work of Cyril Wanner in next-optimized-images.
Read this in other languages: English, Español
Image sizes can often get reduced up to 60%, but this is not the only thing @bazzite/nuxt-optimized-images
does:
WebP
on the fly for an even smaller size.:warning: node >= 10
and nuxt >= 2
are required.
npm install --save-dev @bazzite/nuxt-optimized-images
or
yarn add --dev @bazzite/nuxt-optimized-images
Add @bazzite/nuxt-optimized-images
to buildModules
section of nuxt.config.js:
:warning: If you are using Nuxt < 2.9.0
, use modules
instead.
{
buildModules: [
'@bazzite/nuxt-optimized-images',
],
optimizedImages: {
optimizeImages: true
}
}
See the configuration section for all available options.
:warning: Images won't get optimized out of the box. You have to install the optimization packages you really need in addition to this module. This doesn't force you to download big optimization libraries you don't even use. Please check out the table of all optional optimization packages.
You have to install the optimization packages you need in your project in addition to this module. Then, @bazzite/nuxt-optimized-images
detects all the supported packages and uses them.
So you only have to install these packages with npm, there is no additional step needed after that.
The following optimization packages are available and supported:
Optimization Package | Description | Project Link |
---|---|---|
imagemin-mozjpeg | Optimizes JPEG images | Link |
imagemin-pngquant | Optimizes PNG images | Link |
imagemin-optipng | Alternative for optimizing PNG images | Link |
imagemin-gifsicle | Optimizes GIF images | Link |
imagemin-svgo | Optimizes SVG images and icons | Link |
webp-loader | Optimizes WebP images and can convert JPEG/PNG images to WebP on the fly (WebP resource query) | Link |
lqip-loader | Generates low quality image placeholders and can extract the dominant colors of an image (lqip resource query) | Link |
responsive-loader | Can resize images on the fly and create multiple versions of it for a srcSet . Important: You need to additionally install either jimp (node implementation, slower) or sharp (binary, faster) | Link |
sqip-loader | Loads images and exports tiny SQIP previews as image/svg+xml URL-encoded data | Link |
Example: If you have JPG, PNG, and SVG images in your project, you would then need to run
npm install --save-dev imagemin-mozjpeg imagemin-pngquant imagemin-svgo
# or
yarn add --dev imagemin-mozjpeg imagemin-pngquant imagemin-svgo
To install all optional packages, run:
npm install --save-dev imagemin-mozjpeg imagemin-pngquant imagemin-gifsicle imagemin-svgo webp-loader lqip-loader responsive-loader sqip-loader sharp
# or
yarn add --dev imagemin-mozjpeg imagemin-pngquant imagemin-gifsicle imagemin-svgo webp-loader lqip-loader responsive-loader sqip-loader sharp
:warning: Please note that by default, images are only optimized for production builds, not development builds. However, this can get changed with the optimizeImagesInDev
config.
This project is sponsored by Bazzite. If you require Professional Assistance on your project(s), please contact us at https://www.bazzite.com/contact.
Everyone participating in this project is expected to agree to abide by the Code of Conduct.
Code released under the MIT License.
FAQs
Automatically optimizes images used in Nuxt.js projects (jpeg, png, svg, webp and gif).
The npm package @bazzite/nuxt-optimized-images receives a total of 132 weekly downloads. As such, @bazzite/nuxt-optimized-images popularity was classified as not popular.
We found that @bazzite/nuxt-optimized-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.