{"name":"scope-css","version":"1.1.1","description":"Scope each css rule with a selector, ie. nest into parent","main":"index.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git+https://github.com/dy/scope-css.git"},"keywords":["css","style","insert-css","nesting","scope","nest","parent","selector","sheetify"],"author":{"name":"ΔY","email":"df.creative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dy/scope-css/issues"},"homepage":"https://github.com/dy/scope-css#readme","devDependencies":{"cln":"^1.1.0","tape":"^4.9.1"},"dependencies":{"strip-css-comments":"^3.0.0"},"gitHead":"a5020e5ed42bb7bd200415a440cd178738fa016a","_id":"scope-css@1.1.1","_npmVersion":"6.4.1","_nodeVersion":"8.11.1","_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"dist":{"integrity":"sha512-4cQyZeCZEWwB5gj2yuOYRCw0BBBvmu2Zbbf1LaHcArCmMLGYA1ef6ybuWmNGn7ybMB3ot4d+PKX9Fp45f8DGQA==","shasum":"346b4a39f7cb7c8eb242470eeb893f8c354ee1a5","tarball":"http://registry-npm.ywwl.com/scope-css/download/scope-css-1.1.1.tgz","fileCount":4,"unpackedSize":3499,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbveQqCRA9TVsSAnZWagAAKYwP/RVJ8AbY5qfc6IBChEdB\nmEzyQvvU8KhNPCtPCB/xrMcLdtxaxRc7mQfvSQMvmXCGd04sPAVN/skr8Yp1\ndoakbTZGuBCpUW4k3Yk3qVOfb1W/FLYSVzNpP/C332rK0gGE7g+ncZ4Ewrzx\nLm5b40sMl1ZEgrv2nMtDB9qOeFZ6DIaxrvxNJWovnBqjEtiiURA+VuKF5bDy\nKjO4G/k1150Q3akBKKBDu9DXgGCRgbQOQ5upIs1Sp9k2ZRbN+z2uTvUETAVW\njTlhEreaIHJEXStrth+oDxnJUSgOtMC/Q4zMCEvFtKYtMHWz7Ym//iGYjenE\n0VBsBYuiFxR6a3GzOF33Okvo22zLyDasrUwicwHS8JGxL4MED3WaUf6e7c4Z\nXwDYQwC7cfYguXDby8kjEU2pdHO96mRs587Q1vkWOvtYjKf/mecHGnmNkRXx\nVI0llNxIeBpxjERAZyTdDuhv7CDIRuVyQ/CDG/8nNzL+xLdm4+hp3ZtCisks\nQMk8ZIWw0lRHg/vAuS6pL4YCVYbXi2ISNON/RhyS4MRrrXbO+MuRvvO7a4hi\nmJXjxjQ0HGAwimHrGggWPMix3qKR3cBmjIflpMxP5jTTn0HvL37AYLJ9VdLp\nxaAFWWPKnLUfo/9cGgqKGexnqX6MVtHT0Y+uBhk0I3dcQI3nVTrFm4zvnwHo\nZry+\r\n=kx8z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH2zKGGdN18T22XyQaXE7HY1fiyhpC4E3URtxFXkGLLoAiEAlsxlzAr0AdXR9l6Q1xUrmpR7+LI/f3e1ypUI/+xTBnY="}],"size":1669,"noattachment":false,"key":"/scope-css/-/scope-css-1.1.1.tgz"},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/scope-css_1.1.1_1539171369622_0.3785418513238705"},"_hasShrinkwrap":false,"readme":"# scope-css [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dy/scope-css.svg)](https://travis-ci.org/dy/scope-css)\r\n\r\nPrefix or nest each style selector in a css string. Useful to create namespaced css for components, themes, applications, modular css etc. Also it is tiny.\r\n\r\n## Usage\r\n\r\n[![npm install scope-css](https://nodei.co/npm/scope-css.png?mini=true)](https://npmjs.org/package/scope-css/)\r\n\r\n```js\r\nconst scope = require('scope-css');\r\n\r\nscope(`\r\n.my-component {}\r\n.my-component-element {}\r\n`, '.parent');\r\n\r\n/*\r\n`\r\n.parent .my-component {}\r\n.parent .my-component-element {}\r\n`\r\n*/\r\n```\r\n\r\n## API\r\n\r\n## css = scope(css, parent, options?)\r\n\r\nReturn css string with each rule prefixed with the parent selector. Note that `parent` selector itself will be ignored. Also each `:host` keyword will be replaced with `parent` value. Example:\r\n\r\n```js\r\nscope(`\r\n\t.panel {}\r\n\t:host {}\r\n\t:host .my-element {}\r\n\t.panel .my-element {}\r\n\t.my-element {}\r\n`, '.panel');\r\n\r\n/*\r\n`\r\n\t.panel {}\r\n\t.panel {}\r\n\t.panel .my-element {}\r\n\t.panel .my-element {}\r\n\t.panel .my-element {}\r\n`\r\n*/\r\n```\r\n\r\nOptions can scope keyframes via `{ keyframes: bool|prefixStr }` option, eg.\r\n\r\n```js\r\nscope(`\r\n\t.panel {\r\n\t\tanimation: infinite loading 4s;\r\n\t}\r\n\t@keyframes loading {\r\n\t\tfrom { top: 0; }\r\n\t\tto { top: 100px; }\r\n\t}\r\n`, '.panel', { keyframes: true })\r\n\r\n/*\r\n`\r\n.panel {\r\n\tanimation: infinite panel-loading 4s;\r\n}\r\n@keyframes panel-loading {\r\n\tfrom { top: 0; }\r\n\tto { top: 100px; }\r\n`)\r\n*/\r\n```\r\n\r\n## css = scope.replace(css, 'replacement $1$2')\r\n\r\nApply replace to css, where `$1` is matched selectors and `$2` is rules for the selectors. It does not do any self/host detection, so use it for more flexible replacements.\r\n\r\n```js\r\nscope.replace(`\r\n\t.my-component, .my-other-component {\r\n\t\tpadding: 0;\r\n\t}\r\n`, '$1');\r\n\r\n// `.my-component, my-other-component`\r\n```\r\n\r\n## Credits\r\n\r\nBased on [this question](http://stackoverflow.com/questions/12575845/what-is-the-regex-of-a-css-selector).\r\n","publish_time":1539171369937,"_cnpm_publish_time":1539171369937,"dist-tags":{"latest":"2.0.0"}}