Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
gatsby-plugin-preconnect
Advanced tools
Gatsby plugin to add the crossorigin attribute to every <link rel="preload"> tag
Quickly add a <link rel="preconnect" crossorigin>
tag for every specified domain.
npm install --save gatsby-plugin-preconnect
It simply adds a <link rel="preconnect" href="https://example.com" crossorigin>
to the page (see the
Resource Prioritization - Preconnect
guide).
// In your gatsby-config.js
plugins: [
{
resolve: 'gatsby-plugin-preconnect',
options: {
domains: ['https://foo.com', 'https://bar.com'],
},
},
]
crossOrigin
is set to true
by default but it can be customized, below all the available options
plugins: [
{
resolve: 'gatsby-plugin-preconnect',
options: {
domains: [
'https://foo.com',
'https://bar.com',
{ domain: 'https://enablecors.com', crossOrigin: true },
{ domain: 'https://disablecors.com', crossOrigin: false },
{ domain: 'https://corswithanonymous.com', crossOrigin: 'anonymous' },
{ domain: 'https://corswithcreds.com', crossOrigin: 'use-credentials' },
],
},
},
]
All the available values for crossOrigin
are listed below, every other value makes the plugin throw an error
Value | Equivalent value |
---|---|
undefined | "anonymous" |
true | "anonymous" |
"anonymous" | "anonymous" |
"use-credentials" | "use-credentials" |
false | (attribute not added) |
PR or issues are welcome 👋
npm run build
on the root
then, in every test project, you need to run npm run plugin:link
to locally use itThanks goes to these wonderful people (emoji key):
Stefano Magni 💻 📖 | Dugagjin Lashi 💻 👀 | Sean King 🤔 | Andrew Schneider 💻 📖 ⚠️ | Andreas Donig 🤔 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Gatsby plugin to add the crossorigin attribute to every <link rel="preload"> tag
We found that gatsby-plugin-preconnect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.