Socket
Socket
Sign inDemoInstall

gatsby-source-filesystem

Package Overview
Dependencies
Maintainers
21
Versions
782
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-filesystem

Gatsby plugin which parses files within a directory for further parsing by other plugins


Version published
Weekly downloads
195K
decreased by-15.46%
Maintainers
21
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 05 May 2020

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