Socket
Book a DemoInstallSign in
Socket

@drawbotics/extract-emotion

Package Overview
Dependencies
Maintainers
3
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drawbotics/extract-emotion

Small utility to extract CSS styles from emotion components

6.0.0
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

ExtractEmotion

Very basic tool to do one thing: extract into a css bundle the CSS generated by emotion.

Why should I use this?

We created this tool for a specific use case, where React is the main source of the library (including CSS styling), and we wanted to generate a vanilla JS version of our library. Instead of replicating the CSS twice in emotion and in pure CSS, we made a cli tool to get all the styles into a separate bundle.

We did this because emotion generates classnames and applies styles at runtime, meaning it can't be extracted by webpack plugins currently available, like MiniCSSExtractPlugin.

Prerequisite Notes The tool requires you to have react and emotion installed to work, since the input file given to the tool should include/import the react components using emotion. The entry point should already have been transpiled with babel, that step isn't done by the tool.

Install

npm install -D @drawbotics/extract-emotion

Usage as CLI

npx extract-emotion ./index.js --output ./output-dir

Options

  • filename: Name of the generated CSS bundle file. If this is not passed, it will default to style.css
  • prefix: The tool removes the emotion hashes on classnames, if you want to add a prefix to all your classnames here is where you define it
  • output: Directory to which the CSS bundle will be written to

Development

npm run test
npm run build

FAQs

Package last updated on 11 Feb 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.