Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-adapter-netlify

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-adapter-netlify

Gatsby adapter for Netlify

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
73K
decreased by-1.77%
Maintainers
6
Weekly downloads
 
Created
Source

gatsby-adapter-netlify

Gatsby adapter for Netlify.

This adapter enables following features on Netlify:

This adapter is part of Gatsby's zero-configuration deployments feature and will be installed automatically on Netlify. You can add gatsby-adapter-netlify to your dependencies and gatsby-config to have more robust installs and to be able to change its options.

Installation

npm install gatsby-adapter-netlify

Usage

Add gatsby-adapter-netlify to your gatsby-config and configure the adapter option.

const adapter = require("gatsby-adapter-netlify").default

module.exports = {
  adapter: adapter({
    excludeDatastoreFromEngineFunction: false,
    imageCDN: false,
  }),
}

Options

excludeDatastoreFromEngineFunction

(optional, default: false)

If true, Gatsby will not include the LMDB datastore in the serverless functions used for SSR/DSG. Instead, it will upload the datastore to Netlify's CDN and download it on first load of the functions.

You can also enable this option by setting GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE=true environment variable (useful when using zero-configuration deployments)

imageCDN

(optional, default: false)

If true instead of downloading and processing images at build time, it defers processing until request time using Netlify Image CDN. This can greatly improve build times for sites with remote images, such as those that use a CMS.

You can also enable this option by setting NETLIFY_IMAGE_CDN=true environment variable (useful when using zero-configuration deployments)

You will need additional configuration in your netlify.toml configuration file to allow external domains for images. See Netlify Image CDN Remote Path docs for more information.

Exact Remote Path regular expressions to use will depend on CMS you use and possibly your configuration of it.

  • gatsby-source-contentful:

    [images]
    remote_images = [
      # <your-contentful-space-id> is specified in the `spaceId` option for the
      # gatsby-source-contentful plugin in your gatsby-config file.
      "https://images.ctfassets.net/<your-contentful-space-id>/.*"
    ]
    
  • gatsby-source-drupal:

    [images]
    remote_images = [
      # <your-drupal-base-url> is speciafied in the `baseUrl` option for the
      # gatsby-source-drupal plugin in your gatsby-config file.
      "<your-drupal-base-url>/.*"
    ]
    
  • gatsby-source-wordpress:

    [images]
    remote_images = [
      # <your-wordpress-url> is specified in the `url` option for the
      # gatsby-source-wordpress plugin in your gatsby-config file.
      # There is no need to include `/graphql in the path here`
      "<your-wordpress-url>/.*"
    ]
    

Above examples are the most likely ones to be needed. However if you configure your CMS to host assets on different domain or path, you might need to adjust the patterns accordingly.

If you are using recent versions of Contentful, Drupal or Wordpress source plugins, Gatsby and Netlify Adapter will automatically detect missing Remote Path patterns and will warn you about it and provide the required patterns to add to your configuration.

Keywords

FAQs

Package last updated on 06 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc