0.2.0 • Published 4 years ago

styled-scopify v0.2.0

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

styled-scopify

A wrapper function for styled-components that scopes all of your CSS rules to a root selector. This is useful if you use something like the postcss-scopify plugin. The wrapper function is curried and accepts two arguments - a CSS selector string to use as the scope and the original styled function - and returns the wrapped styled function.

Install

# Yarn
yarn add styled-scopify

# npm
npm install --save styled-scopify

Type Definitions

styledScopify :: String selector -> styled -> styled

Examples

// src/styled.js
import styled from 'styled-components';
import styledScopify from 'styled-scopify';

export default styledScopify('#root', styled);

// src/components/Foo.js
import styled from '../styled';

const Foo = styled.span`
  font-size: 14px;
  color: #333;
`;

// Without this wrapper function you'd have to do this for every component:
const Bar = styled.div`
  #root & {
    ...
  }
`;
0.1.0

4 years ago

0.2.0

4 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago