Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-layouts

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-layouts

Never write `wrapPageElement` or `wrapRootElement` again

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-plugin-layouts

Never write wrapPageElement or wrapRootElement again

Notes

For theme/plugin authors, please don't use this plugin as the layout components may be shadowed by the users of your library.

Table of Contents

  • Installation
  • Usage
  • License

Installation

npm install gatsby-plugin-layouts

Usage

1. Register plugin

In gatsby-config.js:

module.exports = {
  plugins: [
    ...otherPlugins,

    "gatsby-plugin-layouts",
  ],
};

2. Shadow the layout components

a. To create PageLayout

Create src/gatsby-plugin-layouts/page.layout.js:

import React from "react";
import Layout from "../components/Layout";

const PageLayout = ({ children }) => {
  return (
    <Layout>
      {children}
    </Layout>
  );
};

export const BrowserPageLayout = PageLayout;
export const SsrPageLayout = PageLayout;
a. To create RootLayout

Create src/gatsby-plugin-layouts/root.layout.js:

import React from "react";
import { ThemeProvider } from "emotion-theming";

const RootLayout = ({ children }) => {
  return (
    <ThemeProvider>
      {children}
    </ThemeProvider>
  );
};

export const BrowserRootLayout = RootLayout;
export const SsrRootLayout = RootLayout;

License

MIT

Keywords

FAQs

Package last updated on 29 Mar 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