styled-selector
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

styled-selector

Generated with nod NPM version Build Status Coverage Status

Get static CSS(-in-JS) selectors (like .sc-htpNat) from React components

Install

$ npm i styled-selector

Usage

Styled Components

import styled from "styled-components";
import s from "styled-selector";
 
const Comp = styled.div``;
 
s(Comp); // .sc-htpNat

Emotion

import styled, { css } from "react-emotion";
import s from "styled-selector";
 
const Comp = styled("div")``;
 
s(Comp); // .css-htpNat
 
const className = css``;
 
s(className); // .css-htpNat

Reuse

import styled from "styled-components";
import use from "reuse";
import s from "styled-selector";
 
const Comp = use(styled.div``);
 
s(Comp); // .sc-htpNat

Custom

import React from "react";
import s from "styled-selector";
 
const Comp = () => <div id="foo" />;
Comp.selector = "#foo";
 
s(Comp); // #foo

License

MIT © Haz

Install

npm i styled-selector

DownloadsWeekly Downloads

1,142

Version

0.1.1

License

MIT

Unpacked Size

7.89 kB

Total Files

8

Last publish

Collaborators

  • diegohaz