{"name":"cxs","version":"2.1.0","description":"A CSS-in-JS solution for functional CSS in functional UI components","main":"dist/index.js","scripts":{"prepublish":"mkdir -p dist && babel src --out-dir dist","build":"webpack -p","gh-pages":"gh-pages -d example","start":"webpack-dev-server","size":"npm run prepublish && bundle-size ./","standard":"standard","test-watch":"ava -v --watch","test":"ava -v"},"keywords":[],"author":{"name":"Brent Jackson"},"license":"MIT","devDependencies":{"ava":"^0.16.0","babel-cli":"^6.10.1","babel-eslint":"^7.1.0","babel-loader":"^6.2.4","babel-preset-es2015":"^6.9.0","babel-preset-react":"^6.16.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.9.0","bundle-size":"^1.1.4","gh-pages":"^0.11.0","html-loader":"^0.4.3","inline-style-prefixer":"^2.0.0","jsdom":"^9.3.0","jsdom-global":"^2.0.0","json-loader":"^0.5.4","markdown-loader":"^0.1.7","react":"^15.3.2","react-dom":"^15.3.2","standard":"^8.5.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1","yo-yo":"^1.2.1"},"dependencies":{"add-px-to-style":"^1.0.0","glamor":"^2.17.14","murmurhash-js":"^1.0.0"},"ava":{"require":["babel-register"]},"standard":{"parser":"babel-eslint"},"gitHead":"5597e1be924a2d94967a7a619dfd2ba6ccf94516","_id":"cxs@2.1.0","_shasum":"b196b6f4ad05751997913f712120ecae09e31c8e","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"jxnblk","email":"jxnblk@gmail.com"},"dist":{"shasum":"b196b6f4ad05751997913f712120ecae09e31c8e","tarball":"http://registry-npm.ywwl.com/cxs/download/cxs-2.1.0.tgz","integrity":"sha512-hO90gpnHVoMDXvKoXcERZJkgQXVh6v94xp+wNGKARv43pns7yCE57GXU4MZFLI/kWOYwgTGcvjw6Owbs1/fG3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGrfjnkp6OVNLgGF0kQl8a8NQYgITCSxKv41539zSNf+AiAhY/RvxXRf24lSSCoJ8yC+hIdMnjqMx+ioLFpzIkLssA=="}],"size":6233,"noattachment":false,"key":"/cxs/-/cxs-2.1.0.tgz"},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"jxnblk","email":"jxnblk@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/cxs-2.1.0.tgz_1479346000388_0.20619615400210023"},"directories":{},"readme":"\n# cxs\n\nfast af css-in-js in 0.7kb\n\nhttp://jxnblk.com/cxs\n\n[![Build Status][b]](https://travis-ci.org/jxnblk/cxs)\n[![Coverage][cov]](https://codecov.io/github/jxnblk/cxs)\n[![js-standard-style][std]](http://standardjs.com/)\n[![0.7kb gzip][kb]](https://github.com/siddharthkp/bundlesize)\n\n[b]: https://img.shields.io/travis/jxnblk/cxs/master.svg?style=flat-square\n[std]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[kb]: https://img.shields.io/badge/gzip-0.7%20kb-brightgreen.svg?style=flat-square\n[cov]: https://img.shields.io/codecov/c/github/jxnblk/cxs.svg?style=flat-square\n\n```js\nconst className = cxs({ color: 'tomato' })\n```\n\ncxs is a minimal css-in-js solution that uses an atomic css approach to maximize performance and deduplication\n\n## Features\n\n- 0.7 KB\n- Zero dependencies\n- High performance\n- Style encapsulation\n- Deduplicates repeated styles\n- Dead-code elimination\n- Framework independent\n- Media queries\n- Pseudoclasses\n- Nesting\n- No CSS files\n- No tagged template literals\n- Optional [React component](#react-components) API\n\n\n## Install\n\n```sh\nnpm install cxs\n```\n\n## Usage\n\ncxs works with any framework, but this example uses React for demonstration purposes.\n\n```js\nimport React from 'react'\nimport cxs from 'cxs'\n\nconst Box = (props) => {\n  return (\n    <div {...props} className={className} />\n  )\n}\n\nconst className = cxs({\n  padding: '32px',\n  backgroundColor: 'tomato'\n})\n\nexport default Box\n```\n\n### Pseudoclasses\n\n```js\nconst className = cxs({\n  color: 'tomato',\n  ':hover': {\n    color: 'black'\n  }\n})\n```\n\n### Media Queries\n\n```js\nconst className = cxs({\n  fontSize: '32px',\n  '@media screen and (min-width: 40em)': {\n    fontSize: '48px'\n  }\n})\n```\n\n### Child Selectors\n\n```js\nconst className = cxs({\n  color: 'black',\n  ' > a': {\n    color: 'tomato'\n  }\n})\n```\n\n\n### Static/Server-Side Rendering\n\nFor Node.js environments, use the `css()` method to return the static CSS string *after* rendering a view.\n\n```js\nimport React from 'react'\nimport ReactDOMServer from 'react-dom/server'\nimport cxs from 'cxs'\nimport App from './App'\n\nconst html = ReactDOMServer.renderToString(<App />)\nconst css = cxs.css()\n\nconst doc = `<!DOCTYPE html>\n<style>${css}</style>\n${html}\n`\n\n// Reset the cache for the next render\ncxs.reset()\n```\n\nNote: cxs does not currently have a mechanism for rehydrating styles on the client, so use with caution in universal JavaScript applications.\n\n\n## React Components\n\ncxs also has an alternative higher order component API for creating styled React components, similar to the [styled-components][sc] API.\n\n```js\nimport cxs from 'cxs/component'\n\nconst Heading = cxs('h1')({\n  margin: 0,\n  fontSize: '32px',\n  lineHeight: 1.25\n})\n```\n\n### Extending components\n\nTo extend a cxs component, pass it to the component creator function.\n\n```js\nconst Button = cxs('button')({\n  color: 'white',\n  backgroundColor: 'blue'\n})\n\nconst TomatoButton = cxs(Button)({\n  backgroundColor: 'tomato'\n})\n```\n\n### Other components\n\nAny component can be passed to cxs to add styles.\n\n```js\nimport { Link } from 'react-router'\n\nconst MyLink = cxs(Link)({\n  color: 'tomato'\n})\n```\n\nNote: components must accept `className` as a prop to work with cxs.\n\n\n### Functional styles\n\ncxs components can also handle dynamic styling based on props by passing a function as an argument\n\n```js\nconst Heading = cxs('h1')(props => ({\n  color: props.color\n}))\n```\n\n#### Removing style props\n\nTo remove style props from the rendered HTML element,\nuse the [`prop-types`][pt] package to define `propTypes` on a component.\ncxs/component will remove any prop that matches a key from the `propTypes` object.\n\n```js\nimport cxs from 'cxs/component'\nimport PropTypes from 'prop-types'\n\nconst Heading = cxs('h2')(props => ({\n  fontSize: props.big ? '48px' : '32px'\n}))\n\nHeading.propTypes = {\n  big: PropTypes.bool\n}\n```\n\n### styled-system\n\nStyle utility functions, like those in [styled-system][s2], can be used with cxs/component.\n\n```js\nimport cxs from 'cxs/component'\nimport {\n  space,\n  color\n} from 'styled-system'\n\nconst Heading = cxs('h2')(space, color)\n```\n\n### Theming\n\nTheming is supported with the `<ThemeProvider>` component.\n\n```jsx\nimport React from 'react'\nimport ThemeProvider from 'cxs/ThemeProvider'\nimport theme from './theme'\n\nconst App = props => (\n  <ThemeProvider theme={theme}>\n    <Heading>\n      Hello\n    </Heading>\n  </ThemeProvider>\n)\n```\n\n```jsx\nimport cxs from 'cxs/component'\n\nconst Heading = cxs('h2')(props => ({\n  fontSize: props.theme.fontSizes[4] + 'px',\n  color: props.theme.blue\n}))\n```\n\n## API\n\n### `cxs(...styles)`\n\nAccepts styles objects or functions that return style objects and returns a className string.\n\n### `cxs.css()`\n\nReturns the rendered CSS string for static and server-side rendering.\n\n### `cxs.reset()`\n\nResets the cache for server-side rendering\n\n### `cxs/component`\n\nA [styled-components][sc]-like API for creating React components with cxs.\n\n---\n\n### Vendor prefixes\n\ncxs **does not** handle vendor prefixing to keep the module size at a minimum.\n\n### Previous Versions\n\nFor previous versions of cxs, see the [v3 branch][v3] or [v4 branch][v4]\n\n[sc]: https://www.styled-components.com (styled-components)\n[pt]: https://www.npmjs.com/package/prop-types\n\n[s2]: https://github.com/jxnblk/styled-system\n[v3]: https://github.com/jxnblk/cxs/tree/v3\n[v4]: https://github.com/jxnblk/cxs/tree/v4\n\n[MIT License](LICENSE.md)\n","publish_time":1479346000969,"_cnpm_publish_time":1479346000969,"dist-tags":{"alpha":"6.1.0-0","beta":"3.0.0-b6","latest":"6.2.0"}}