{"name":"aphrodite-jss","description":"Aphrodite-like API on top of JSS.","version":"1.0.1","scripts":{"all":"npm run lint && npm run build","clean":"rm -fr ./lib/*","build":"npm run clean && npm run build:lib && npm run build:max && npm run build:min","build:lib":"cross-env babel src --out-dir lib","build:max":"cross-env NODE_ENV=development webpack src/index.js dist/aphrodite-jss.js","build:min":"cross-env NODE_ENV=production webpack src/index.js dist/aphrodite-jss.min.js","lint":"eslint ./src ./tests ./benchmark ./*.js","lint:staged":"lint-staged","prepublish":"npm run all"},"author":{"name":"Oleg Slobodskoi","email":"oleg008@gmail.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/cssinjs/aphrodite-jss.git"},"keywords":["jss","cssinjs","css-in-js","aphrodite","react"],"license":"MIT","main":"./lib/index.js","engines":{"node":">=4.0.0 <7.0.0"},"devDependencies":{"babel-cli":"^6.5.1","babel-core":"^6.5.1","babel-eslint":"^7.1.1","babel-loader":"^6.2.2","babel-plugin-inline-version":"^1.0.2","babel-plugin-transform-es3-member-expression-literals":"^6.8.0","babel-preset-es2015":"^6.5.0","babel-preset-stage-0":"^6.5.0","es5-shim":"^4.3.1","eslint":"^3.0.1","eslint-config-airbnb":"^9.0.1","eslint-config-jss":"^3.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"^1.0.2","eslint-plugin-react":"^5.0.1","json-loader":"^0.5.4","lint-staged":"^3.2.2","pre-commit":"^1.2.0","webpack":"^1.12.2"},"dependencies":{"jss":"^6.0.1","jss-preset-default":"^1.1.0","murmurhash-js":"^1.0.0"},"lint-staged":{"./src ./tests ./benchmark ./*.js":["eslint","git add"]},"gitHead":"9704791ca5e04c363599c7b1b784641b1b058161","bugs":{"url":"https://github.com/cssinjs/aphrodite-jss/issues"},"homepage":"https://github.com/cssinjs/aphrodite-jss#readme","_id":"aphrodite-jss@1.0.1","_shasum":"b069198d07ade43013bf8355c207a5d59c514c49","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.0.0","_npmUser":{"name":"kof","email":"oleg008@gmail.com"},"dist":{"shasum":"b069198d07ade43013bf8355c207a5d59c514c49","tarball":"http://registry-npm.ywwl.com/aphrodite-jss/download/aphrodite-jss-1.0.1.tgz","integrity":"sha512-b+0F5NeccxBMxB7RXRiHx9ynESpfcF/QRnt6hKottgS1Re6OjGxuOSTFF4a1FMf85Dv9yFDssZofVbC0VSEmbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIshGgzQ0TaN2GK/QRK+7kLyaKCPIj+LEZs0HBN9StzwIhAPmJc7QVzhTRjHGyMFybBL52hOpOhGe/70d+fk9Xxe21"}],"size":223435,"noattachment":false,"key":"/aphrodite-jss/-/aphrodite-jss-1.0.1.tgz"},"maintainers":[{"name":"kof","email":"oleg008@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/aphrodite-jss-1.0.1.tgz_1489161094756_0.8489749459549785"},"directories":{},"readme":"# Aphrodite-like API on top of JSS.\n\nThis project is a merge of good ideas from [aphrodite](https://github.com/Khan/aphrodite) and [JSS](https://github.com/cssinjs/jss). It provides an API of aphrodite but fixes lots of limitations and caveats by using JSS as a rendering engine under the hood.\n\n## Good parts from aphrodite.\n\n- Pretty much like inline styles known from React, except it allows to use the entire CSS.\n- No CSS is generated until `css()` function invocation. Only the passed rules are converted to a CSS string and injected.\n- Theming is possible without any headache or framework integrations.\n\n## Benefits compared to aphrodite.\n\n- More powerfull rendering abstraction through [JSS](https://github.com/cssinjs/jss) under the hood. You are using all it's plugins and [JSON DSL](https://github.com/cssinjs/jss/blob/master/docs/json-api.md). To name a few:\n  - Children, siblings and any other kinds of selectors. ([jss-nested](https://github.com/cssinjs/jss-nested))\n  - Global styles, without auto namespacing ([jss-global](https://github.com/cssinjs/jss-global)).\n- Immediate render upon `css()` call invocation. It gives you an access to computed styles right after render, no need to use `setTimeout()`. It also avoids additional recalcs and repaints, which can cause flickers and general performance overhead.\n- No auto \"!important\" insertion. You can write a plugin for this though.\n\n\n## Example\n\n```javascript\nimport {StyleSheet, css} from 'aphrodite-jss'\n\nconst sheet = StyleSheet.create({\n  button: {\n    border: '1px solid',\n    borderRadius: 5,\n    fontSize: 'inherit',\n    lineHeight: '2.3em',\n    padding: '0 1em',\n    boxShadow: 'inset 0 1px 0 rgba(255, 255, 255, 0.1)',\n    textShadow: '0 -1px 0 rgba(0, 0, 0, 0.25)',\n    backgroundRepeat: 'repeat-x',\n    color: '#fff',\n    fontWeight: 400,\n    '& span': {\n      marginRight: 5,\n      color: '#fff'\n    }\n  },\n  primary: {\n    borderColor: '#1177cd #0f6ab6 #0d5c9e',\n    backgroundImage: 'linear-gradient(to bottom, #2591ed 0%, #1177cd 100%)',\n    backgroundColor: '#1385e5',\n    '&:hover': {\n      backgroundImage: 'linear-gradient(to bottom, #3c9def 0%, #1385e5 100%)'\n    }\n  }\n})\n\ndocument.body.innerHTML = `\n  <button class=\"${css(sheet.button, sheet.primary)}\">\n    <span>&#10004;</span>Primary\n  </button>\n`\n```\n\n## API\n\n### Create style sheet.\n\n`StyleSheet.create(styles)`\n\nCreate function doesn't render anything, it just registers your styles.\n\nReturns an object, where key names correspond the original styles obejct.\n\n### Inject rules.\n\n`css(rule1, [rule2], [rule3], ...)`\n\nInjects a previously defined rule to the dom. This is done in sync, so the CSS rule is immediately available.\n\nReturns a class name.\n\n### Styles format.\n\nThe format for styles is defined in [jss](https://github.com/cssinjs/jss/blob/master/docs/json-api.md). Aprodisiac uses [jss-preset-default](https://github.com/cssinjs/jss-preset-default), so all default presets are already in place.\n\n### Customizing JSS.\n\n`aphroditeJss(jss, [options])`\n\nYou can pass your own JSS instance with your custom setup.\n\nReturns aphrodite's interface.\n\n```javascript\nimport aphroditeJss from 'aphrodite-jss'\nimport {create} from 'jss'\n\nconst {css, StyleSheet} = aphroditeJss(create())\n```\n\n### Serverside Rendering.\n\nThere are 2 functions you need to know - `toString()` and `reset()`.\nAs aphrodite-jss can not know that you are rendering a new response, you need to get the CSS (`toString()`) when you are processing the first request and call `reset()` to clean up the styles your current page has produced.\n\n\n```javascript\nimport {toString, reset} from 'aphrodite-jss'\n\nfunction render() {\n  const app = renderApp()\n  const css = toString()\n  reset()\n\n  return `\n    <head>\n      <style>\n        ${css}\n      </style>\n    <head>\n    <body>\n      ${app}\n    </body>\n  `\n}\n```\n\n## License\n\nMIT\n","publish_time":1489161095327,"_cnpm_publish_time":1489161095327,"dist-tags":{"latest":"2.1.0"}}