Socket
Book a DemoInstallSign in
Socket

babel-plugin-styled-components-require

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-styled-components-require

Babel plugin that adds styled-components import declaration

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
47
-32.86%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-styled-components-require

Build
Status npm

 

Babel plugin that adds styled-components import declaration.

 

Example

Your component.js that contains this code:

const Card = styled.div`
  background: #FFF;
  border: 1px solid #DDD;
  border-radius: 2px;
  padding: 10px;
`;
export default Card;

will be transpiled to:

import styled from 'styled-components';

const Card = styled.div`
  background: #FFF;
  border: 1px solid #DDD;
  border-radius: 2px;
  padding: 10px;
`;
export default Card;

 

Usage

npm install babel-plugin-styled-components-require --save-dev

Add styled-components-require into .babelrc

{
  "plugins": [
    "styled-components-require"
  ]
}

 

Tests

✓ add import statement if styled.* is present

✓ do not add to already transpiled code

✓ do not add import styled-components twice

✓ do not add if it already imported

 

You like?

:star: this repo

 

License

MIT © siddharthkp

Keywords

babel

FAQs

Package last updated on 16 Aug 2017

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