{"name":"jss-compose","description":"JSS plugin that enables selector composition","version":"1.0.0","author":{"name":"Pavel Davydov","email":"typical000@gmail.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/cssinjs/jss-compose.git"},"keywords":["cssinnjs","css-in-js","css in js","jss","plugin","compose","composition"],"scripts":{"all":"npm run lint && npm run test && npm run build","build":"npm run clean && npm run build:lib && npm run build:max && npm run build:min","clean":"rimraf ./lib/*","build:lib":"babel src --out-dir lib","build:max":"cross-env NODE_ENV=development webpack src/index.js dist/jss-compose.js","build:min":"cross-env NODE_ENV=production webpack src/index.js dist/jss-compose.min.js","lint":"eslint ./src","lint:staged":"lint-staged","test":"karma start --single-run ","test:watch":"karma start","prepublish":"npm run all"},"license":"MIT","main":"./lib/index.js","devDependencies":{"babel-cli":"^6.5.1","babel-core":"^6.5.1","babel-eslint":"^6.1.2","babel-loader":"^6.2.4","babel-preset-es2015":"^6.9.0","babel-preset-stage-0":"^6.5.0","cross-env":"^2.0.1","eslint":"^2.8.0","eslint-config-airbnb":"^8.0.0","eslint-config-jss":"^1.1.0","eslint-plugin-import":"^1.12.0","eslint-plugin-jsx-a11y":"^1.5.5","eslint-plugin-react":"^5.0.1","expect.js":"^0.3.1","jss":"^5.5.0","karma":"^1.1.1","karma-benchmark":"^0.6.0","karma-benchmark-reporter":"^0.1.1","karma-browserstack-launcher":"^1.0.0","karma-chrome-launcher":"^1.0.1","karma-coverage":"^1.1.0","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.0.1","karma-mocha-reporter":"^2.0.2","karma-safari-launcher":"^1.0.0","karma-sourcemap-loader":"^0.3.5","karma-webpack":"^1.7.0","lint-staged":"^3.0.1","lodash.assign":"^4.0.9","mocha":"^3.0.2","pre-commit":"^1.1.3","rimraf":"^2.5.4","webpack":"^1.12.2"},"peerDependencies":{"jss":"^5.5.0"},"lint-staged":{"./src/*.js":["eslint --fix","git add"]},"pre-commit":"lint:staged","gitHead":"b000afd164247dc7cb0f75f93386591f5e90e94b","bugs":{"url":"https://github.com/cssinjs/jss-compose/issues"},"homepage":"https://github.com/cssinjs/jss-compose#readme","_id":"jss-compose@1.0.0","_shasum":"db89ec29b7ee56c82fea37cea2e30dc76c7a6218","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"typical000","email":"typical000@gmail.com"},"dist":{"shasum":"db89ec29b7ee56c82fea37cea2e30dc76c7a6218","tarball":"http://registry-npm.ywwl.com/jss-compose/download/jss-compose-1.0.0.tgz","integrity":"sha512-V8EhcDl27albFzthGwg6hAsnp0RISUvAivus4cLhjeElANEhKuIQPzi3Lhk9d+OjEEkbfmDhFgINdp/qZDEu/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICetWT7cJrrPHyxAKqP7b+VE8PNbpMTD6Q6RBxiKzWwfAiBUHmRvleGhJUtnBzHoZrucZESFHO0YW5JCDupd0hBo1A=="}],"size":9122,"noattachment":false,"key":"/jss-compose/-/jss-compose-1.0.0.tgz"},"maintainers":[{"name":"typical000","email":"typical000@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/jss-compose-1.0.0.tgz_1474789671826_0.9095549515914172"},"directories":{},"readme":"# JSS plugin for classes composition\n\nThis plugin allows you to use CSS frameworks and legacy code together with JSS as well as reuse Rules more granularly.\n\nMake sure you read [how to use\nplugins](https://github.com/cssinjs/jss/blob/master/docs/setup.md#setup-with-plugins)\nin general.\n\n[![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/cssinjs/lobby)\n\n## Compose with global classes.\n\nTo combine JSS with CSS framework like [Material Design Lite](https://getmdl.io/) or [Bootstrap](http://getbootstrap.com/) and others.\n\n```javascript\nconst styles = {\n  button: {\n    // Using space separated class names.\n    composes: 'btn btn-primary',\n    color: 'red'\n  }\n  buttonActive: {\n    // Using an array of class names.\n    composes: ['btn', 'btn-primary'],\n    color: 'blue'\n  }\n}\n```\nCompiles to:\n\n```css\n.button-123456 {\n  color: red;\n}\n.buttonActive-123456 {\n  color: blue;\n}\n```\n\nWhen you use it:\n\n```javascript\n<button className={classes.button}>Button</button>\n<button className={classes.buttonActive}>Active Button</button>\n```\nIt renders to:\n```html\n<button class=\"button-123456 btn\">Button</button>\n<button class=\"button-123456 btn btn-primary\">Active Button</button>\n```\n\n## Compose with local classes.\n\nManage element states without rules duplication.\nTo reference a local rule, prefix the rule name with `$` symbol.\n\n```javascript\nconst styles = {\n  button: {\n    color: 'black'\n  },\n\n  // You can chain compositions\n  buttonActive: {\n    composes: '$button',\n    color: 'red'\n  },\n  buttonActiveDisabled: {\n    composes: '$buttonActive',\n    opacity: 0.5\n  },\n\n  // Or use arrays\n  disabled: {\n    opacity: 0.5\n  },\n  active: {\n    color: 'red'\n  },\n  buttonDisabled: {\n    composes: ['$button', '$active', '$disabled']\n  }\n}\n```\n\nCompiles to:\n\n```css\n.button-123456 {\n  color: black;\n}\n.buttonActive-123456 {\n  color: red;\n}\n.buttonActiveDisabled-123456 {\n  opacity: 0.5;\n}\n.disabled-123456 {\n  opacity: 0.5;\n}\n.active-123456 {\n  color: red;\n}\n/* Rule `buttonDisabled` is not compiled to CSS, because it has no own properties. */\n```\n\nWhen you use it:\n\n```javascript\n<button className={classes.buttonActiveDisabled}>Active Disabled Button</button>\n<button className={classes.buttonDisabled}>Disabled Button with active state</button>\n```\nIt renders to:\n```html\n<button class=\"button-123456 buttonActive-123456\">Active Disabled Button</button>\n<button class=\"buttonDisabled-123456 button-123456 active-123456 disabled-123456\">Disabled Button with active state</button>\n```\n\n## Mix global and local classes.\n\nYou can compose both local and global classes at the same time.\n\n```javascript\nconst styles = {\n  active: {\n    color: 'red'\n  },\n  button: {\n    composes: ['$active', 'btn', 'btn-primary'],\n    color: 'blue'\n  }\n}\n```\n\nCompiles to:\n\n```css\n.active-123456 {\n  color: red;\n}\n.button-123456 {\n  color: blue;\n}\n```\n\nWhen you use it:\n\n```javascript\n<button className={classes.button}>Button</button>\n```\nIt renders to:\n```html\n<button class=\"button-123456 active-123456 btn btn-primary\">Button</button>\n```\n\n## Caveats\n\n- Doesn't work within [global Style Sheets](https://github.com/cssinjs/jss-global).\n- Does not work inside of [nested rules](https://github.com/cssinjs/jss-nested).\n- When composing local rules, they need to be defined first. Otherwise you get wrong css selector order and specificity.\n\n## Issues\n\nFile a bug against [cssinjs/jss prefixed with \\[jss-compose\\]](https://github.com/cssinjs/jss/issues/new?title=[jss-compose]%20).\n\n## Run tests\n\n```bash\nnpm i\nnpm test\n```\n\n## License\n\nMIT\n","publish_time":1474789673054,"_cnpm_publish_time":1474789673054,"dist-tags":{"latest":"5.0.0"}}