{"name":"scope-css","version":"2.0.0","description":"Scope each css rule with a selector, ie. nest into parent","main":"index.js","type":"module","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","tst":"^9.2.1"},"gitHead":"5036fa0fa1f4c09fdf6724711f4c9556a1c3041c","_id":"scope-css@2.0.0","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-+vmA6153DD1oYy6x6ZDm1c6hNTAsbF/5b2zAvdhtVbwr2s3QyKtJXd/Pr4zWwZCTJo6Zhoy8cOKvXa663XQwlA==","shasum":"ee6760de19febe576a16f7a819364578ccb4b2d9","tarball":"http://registry-npm.ywwl.com/scope-css/download/scope-css-2.0.0.tgz","fileCount":5,"unpackedSize":5827,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC+Lv5t4MEqGejowD76Hcw54o9VE7IKRtqj4GeJfLrS4AiEApKMtRev3qdwjys4KKAQCbZ6S160JZ2XyN4uiq8fTFAo="}],"size":2889,"noattachment":false,"key":"/scope-css/-/scope-css-2.0.0.tgz"},"_npmUser":{"name":"dfcreative","email":"df.creative@gmail.com"},"directories":{},"maintainers":[{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/scope-css_2.0.0_1769641977578_0.6453172637567823"},"_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)\n\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.\n\n## Usage\n\n[![npm install scope-css](https://nodei.co/npm/scope-css.png?mini=true)](https://npmjs.org/package/scope-css/)\n\n```js\nconst scope = require('scope-css');\n\nscope(`\n.my-component {}\n.my-component-element {}\n`, '.parent');\n\n/*\n`\n.parent .my-component {}\n.parent .my-component-element {}\n`\n*/\n```\n\n## API\n\n## css = scope(css, parent, options?)\n\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:\n\n```js\nscope(`\n\t.panel {}\n\t:host {}\n\t:host .my-element {}\n\t.panel .my-element {}\n\t.my-element {}\n`, '.panel');\n\n/*\n`\n\t.panel {}\n\t.panel {}\n\t.panel .my-element {}\n\t.panel .my-element {}\n\t.panel .my-element {}\n`\n*/\n```\n\nOptions can scope keyframes via `{ keyframes: bool|prefixStr }` option, eg.\n\n```js\nscope(`\n\t.panel {\n\t\tanimation: infinite loading 4s;\n\t}\n\t@keyframes loading {\n\t\tfrom { top: 0; }\n\t\tto { top: 100px; }\n\t}\n`, '.panel', { keyframes: true })\n\n/*\n`\n.panel {\n\tanimation: infinite panel-loading 4s;\n}\n@keyframes panel-loading {\n\tfrom { top: 0; }\n\tto { top: 100px; }\n`)\n*/\n```\n\n## css = scope.replace(css, 'replacement $1$2')\n\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.\n\n```js\nscope.replace(`\n\t.my-component, .my-other-component {\n\t\tpadding: 0;\n\t}\n`, '$1');\n\n// `.my-component, .my-other-component`\n```\n\n## See also\n\n* [scoped css polyfill](https://github.com/samthor/scoped)\n\n## Credits\n\nBased on [this question](http://stackoverflow.com/questions/12575845/what-is-the-regex-of-a-css-selector).\n","publish_time":1769641977717,"_cnpm_publish_time":1769641977717,"dist-tags":{"latest":"2.0.0"}}