# @talves/gatsby-theme-site-provider

> Gatsby theme for adding shadowable theme provider to multiple Gatsby themes for composition.

Latest version **0.0.1** (published 2020-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @talves/gatsby-theme-site-provider
pnpm add @talves/gatsby-theme-site-provider
yarn add @talves/gatsby-theme-site-provider
bun add @talves/gatsby-theme-site-provider
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-05-23 |
| First published | 2020-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | talves |

## Links

- npm: https://www.npmjs.com/package/@talves/gatsby-theme-site-provider
- Repository: @talves/gatsby-theme-plugins
- npm.io page: https://npm.io/package/@talves/gatsby-theme-site-provider

## Dependencies (2)

- [theme-ui](https://npm.io/package/theme-ui.md) ^0.3.1
- [@talves/gatsby-theme-ui-presets](https://npm.io/package/@talves/gatsby-theme-ui-presets.md) ^0.0.1

## Recent versions

- 0.0.1 (latest) — 2020-05-23

## README

# @talves/gatsby-theme-site-provider

Gatsby theme for adding shadowable theme provider to multiple Gatsby themes for composition.

```sh
yarn add gatsby-theme-site-provider
```

In your theme, import and export the provider exports in src/provider.js.

```js
// example provider.js
export * from '@talves/gatsby-theme-site-provider'
```

Wrap our theme in an isolated provider, but make sure we pass along the consumers preference to wrapRootElement with the default provider.

```js
// gatsby-config.js
module.exports = options => {
  const wrapRootElement = options && options.wrapRootElement;
  return {
    plugins: [
      {
        resolve: `@talves/gatsby-theme-site-provider`,
        options: {
          wrapRootElement,
        },
      },
    ],
  };
};
```

If you want to use a different theme for all the themes using `@talves/gatsby-theme-site-provider` then shadow the themes/index.js file in this plugin.

```js
// src/@talves/gatsby-theme-site-provider/themes/index.js
export { default } from '@theme-ui/preset-swiss'
```

To shadow the provider you should add this plugin to your main site, then shadow it using the path below from your own provider. This is **ONLY** needed of you have some special setup that will extend the provider for all the themes.

```js
// src/@talves/gatsby-theme-site-provider/provider.js
export * from '../../provider'
```

End-users of a theme that is built with `gatsby-theme-site-provider` can shadow the same provider.js in the theme to use the theme context of the site. Make sure to flag `wrapRootElement: false` in options for all themes then `wrapRootElement: true` for the site to use the same provider.

---
_Source: https://npm.io/package/@talves/gatsby-theme-site-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
