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

gatsby-source-filesystem

Package Overview
Dependencies
Maintainers
10
Versions
784
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-filesystem

Gatsby source plugin for building websites from local data. Markdown, JSON, images, YAML, CSV, and dozens of other data types supported.

  • 5.12.0-next.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
191K
decreased by-14.35%
Maintainers
10
Weekly downloads
 
Created

What is gatsby-source-filesystem?

The gatsby-source-filesystem plugin is used in Gatsby to source data from the local filesystem. It allows you to read files from your project directory and make them available to your Gatsby site as GraphQL nodes. This is particularly useful for sourcing data from markdown files, images, JSON files, and other static assets.

What are gatsby-source-filesystem's main functionalities?

Sourcing Markdown Files

This configuration allows you to source markdown files from the 'src/markdown-pages' directory. These files can then be queried using GraphQL and transformed into pages or other content.

const path = require('path');

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        name: 'markdown-pages',
        path: path.join(__dirname, 'src', 'markdown-pages'),
      },
    },
  ],
};

Sourcing Images

This configuration allows you to source image files from the 'src/images' directory. These images can then be processed and optimized using other Gatsby plugins like gatsby-plugin-sharp.

const path = require('path');

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        name: 'images',
        path: path.join(__dirname, 'src', 'images'),
      },
    },
  ],
};

Sourcing JSON Files

This configuration allows you to source JSON files from the 'src/data' directory. These JSON files can then be queried using GraphQL and used to build dynamic pages or components.

const path = require('path');

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        name: 'data',
        path: path.join(__dirname, 'src', 'data'),
      },
    },
  ],
};

Other packages similar to gatsby-source-filesystem

Keywords

FAQs

Package last updated on 03 Jul 2023

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