#swc-plugin #emotion #com #next #documentation #css-in-js #babel-plugin-transform-imports

swc_plugin_emotion

SWC plugin for https://www.npmjs.com/package/babel-plugin-transform-imports

17 releases (breaking)

0.12.4 Nov 10, 2022
0.12.1 Oct 20, 2022
0.0.0 Jul 5, 2021

#14 in #next

Download history 1/week @ 2024-07-17 22/week @ 2024-07-24 1/week @ 2024-09-25 2/week @ 2024-10-02

60 downloads per month

Apache-2.0

6KB
73 lines

emotion

The official plugin for emotion css-in-js library.

Configuration

The plugin uses the same config as described in Next emotion documentation.

{
  jsc: {
    ...
   experimental: {
     plugins: [ ['@swc/plugin-emotion', {
      // default is true. It will be disabled when build type is production.
      sourceMap?: boolean,
      // default is 'dev-only'.
      autoLabel?: 'never' | 'dev-only' | 'always',
      // default is '[local]'.
      // Allowed values: `[local]` `[filename]` and `[dirname]`
      // This option only works when autoLabel is set to 'dev-only' or 'always'.
      // 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.
      labelFormat?: string,
    }] ]
   }
}

Credit

Source code for plugin itself (not transforms) are copied from https://github.com/IvanRodriCalleja/emotion-swc-plugin

Dependencies

~10–17MB
~235K SLoC