Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@netlify/ipx
Advanced tools
On Demand image optimization for Netlify using ipx.
😺 Online demo: https://netlify-ipx.netlify.app
Add @netlify/ipx
as devDependency
:
# npm
npm i -D @netlify/ipx
# yarn
yarn add --dev @netlify/ipx
Create netlify/functions/ipx.ts
:
import { createIPXHandler } from "@netlify/ipx";
export const handler = createIPXHandler({
domains: ["images.unsplash.com"],
});
Now you can use IPX to optimize both local and remote assets ✨
Resize /test.jpg
(in dist
):
<img src="/.netlify/functions/ipx/w_200/static/test.jpg" />
Resize and change format for a remote url:
<img
src="/.netlify/functions/ipx/f_webp,w_450/https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba"
/>
Instead of setting an allowlist on domains
, you may wish to use the option remotePatterns
. This method allows wildcards in hostname
and pathname
segments.
remotePatterns
is an array that contains RemotePattern objects:
remotePatterns: [
{
protocol: 'https' // or 'http' - not required
hostname: 'example.com' // required
port: '3000' // not required
pathname: '/blog/**' // not required
}
]
To use remote patterns, create netlify/functions/ipx.ts
:
import { createIPXHandler } from "@netlify/ipx";
export const handler = createIPXHandler({
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
},
],
});
hostname
and pathname
may contain wildcards:
remotePatterns: [
{
hostname: '*.example.com' // * = match a single path segment or subdomain
pathname: '/blog/**' // ** = match any number of path segments or subdomains
}
]
yarn install
yarn build
yarn dev
.MIT
1.4.6 (2023-11-14)
FAQs
on-demand image optimization for Netlify
The npm package @netlify/ipx receives a total of 48,249 weekly downloads. As such, @netlify/ipx popularity was classified as popular.
We found that @netlify/ipx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 18 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.