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

gatsby-plugin-emotion

Package Overview
Dependencies
Maintainers
17
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-emotion

Gatsby plugin to add support for Emotion

  • 8.9.0-next.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31K
decreased by-8.07%
Maintainers
17
Weekly downloads
 
Created
Source

gatsby-plugin-emotion

Provide support for using the css-in-js library Emotion including server side rendering.

This plugin supports Emotion v11+

Older versions should use versions of this plugin which support Emotion 8 and 9. Check out the Emotion 10 migration guide for more information on how to upgrade.

Install

npm install gatsby-plugin-emotion @emotion/react @emotion/styled

How to use

Add the plugin to your gatsby-config.js.

module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-emotion`,
      options: {
        // Accepts the following options, all of which are defined by `@emotion/babel-plugin` plugin.
        // The values for each key in this example are the defaults the plugin uses.
        sourceMap: true,
        autoLabel: "dev-only",
        labelFormat: `[local]`,
        cssPropOptimization: true,
      },
    },
  ],
}

Options

The plugin supports the same options that you can pass into @emotion/babel-plugin.

OptionTypeDescriptionDefaultRequired
sourceMapbooleanTells the plugin to inject source maps for use in browser dev tools in development.true
autoLabel'dev-only' ∣ 'always' ∣ 'never'Automatically adds the label property to styles so that class names generated by css or styled include the name of the variable the result is assigned to. You can read more about this option in @emotion/babel-plugin's docsdev-only
labelFormatstringOnly works when autoLabel is set to true. It allows you to define the format of the resulting label. The format is defined via string where variable parts are enclosed in square brackets []. For example labelFormat: "my-classname--[local]", where [local] will be replaced with the name of the variable the result is assigned to."[local]"
cssPropOptimizationbooleanAssumes that you are using something to make @emotion/react’s jsx function work for all jsx. If you are not doing so and you do not want such optimizations to occur, disable this option.true

Keywords

FAQs

Package last updated on 21 Mar 2023

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