JSPM

gatsby-source-filesystem

1.0.0-alpha11-alpha.6ffa9761
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 215838
  • Score
    100M100P100Q170925F
  • License MIT

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

Package Exports

  • gatsby-source-filesystem

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gatsby-source-filesystem) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gatsby-source-filesystem

Plugin for finding source nodes on the file system. The various Gatsby "parse" plugins parse files found by this plugin into various types of child nodes.

Install

npm install --save gatsby-source-filesystem

How to use

// In your gatsby-config.js
plugins: [
  // You can have multiple instances of this plugin
  // to read source nodes from different locations on your
  // filesystem.
  //
  // The following sets up the Jekyll pattern of having a
  // "pages" directory for Markdown files and a "data" directory
  // for `.json`, `.yaml`, `.csv`.
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `docs`,
      path: `${__dirname}/pages/`,
    },
  },
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `packages`,
      path: `${__dirname}/data/`,
    },
  },
]

How to query

You can query file nodes like the following:

{
  allFile {
    edges {
      node {
        extension
        dirname
        modifyDate
      }
    }
  }
}