JSPM

styled-selector

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 198
  • Score
    100M100P100Q82842F
  • License MIT

Get static CSS(-in-JS) selectors from React components

Package Exports

  • styled-selector

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (styled-selector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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