gatsby-plugin-external-css

Current npm package version Downloads per month on npm.

Add external custom css files to your generated html pages.

Installation

npm install gatsby-plugin-external-css

or

yarn add gatsby-plugin-external-css

Usage

This plugin lets you add a custom css file in your builded public index.html. You probably don’t need this as it’s for very specific usage.

In my case, I’m generating different gatsby projects based on a config, and I’m providing a custom way to give a css file out of the src folder scope.

Add the following plugin to your gatsby-config.js

Create

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-external-css',
      options: {
        source: 'full/local/path.css',
      },
    },
  ],
}

Be sure that the file exists.

The file will be copied into the final public file with a custom cache busting. The css file will be appended at the last of the meta.