Gatsby Theme dslemay Core
This theme installs some core Gatsby plugins used by many sites. This resolves the problem of installing and updating many packages in each Gatsby project. This package installs and adds the following packages to your
Installation and Usage
To install this theme run the command below.
yarn add gatsby-theme-dslemay-core
npm i gatsby-theme-dslemay-core
Once installed, your
gatsby-config.js will need to be updated to use the theme. This can be done by adding the following code.
// gatsby-config.jsmoduleexports =__experimentalThemes:resolve: 'gatsby-theme-dslemay-core'options:analytics: 'tracking-id' // Object or stringsitemap: true // Boolean...
Gatsby will then merge the plugins defined in the package's gatsby-config onto yours. As a result, you do not need to install or manually add any of the packages listed above to your project.
Gatsby Source Filesystem
Out of the box, the theme will connect
src/images to GraphQL. The theme will create these folders automatically if they do not exist. Any files beginning with a
. in the data folder will be ignored. Since
gatsby-source-filesystem is installed as a dependency of the theme, you may also add more folders in your
gatsby-config.js without needing to manually install the package separately.
This theme exposes several options for configuring its behavior. These can be configured within the
options object when theme is resolved as shown in the installation instructions above.
- Option key:
If enabled, Gatsby will add Google Analytics tracking configuration to your pages during production builds. It is off by default. The configuration accepts a string or an object to enable Google Analytics tracking. The configuration object accepts all of the keys listed in the Gatsby plugin
- String: Must be your Google Analytics tracking id. Sets the
anonymizeoption to true.
- Object: Pass in the same options listed in the plugin docs. Anonymize is defaulted to true, but can be overriden by your configuration object.
- Option key:
If enabled, Gatsby will generate a sitemap for your site during production builds. Note: This requires a
siteUrl in your
siteMetadata if enabled. Failing to set this property in your
gatsby-config.js will result in a build error.
Conditionally added plugins
Gatsby has a number of plugins which may be added dependening on other dependencies you use in your project. For example
gatsby-plugin-flow will add the necessary Babel config to strip out flow types, and
gatsby-plugin-emotion will handle the Babel presets to use Emotion's css prop without needing to use the JSX pragma at the top of each file. The following plugins will be added automatically if you have the corresponding dependency installed.
The installed column indicates whether the config checks for the package in
devDependencies or both.
|Dependency||Installed||Version Reqs||Gatsby Plugin|