{"name":"cssesc","version":"3.0.0","description":"A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.","homepage":"https://mths.be/cssesc","engines":{"node":">=4"},"main":"cssesc.js","bin":{"cssesc":"bin/cssesc"},"man":["man/cssesc.1"],"keywords":["css","escape","identifier","string","tool"],"license":"MIT","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/cssesc.git"},"bugs":{"url":"https://github.com/mathiasbynens/cssesc/issues"},"scripts":{"build":"grunt template && babel cssesc.js -o cssesc.js","test":"mocha tests","cover":"istanbul cover --report html node_modules/.bin/_mocha tests -- -u exports -R spec"},"devDependencies":{"babel-cli":"^6.26.0","babel-preset-env":"^1.6.1","codecov":"^1.0.1","grunt":"^1.0.1","grunt-template":"^1.0.0","istanbul":"^0.4.4","mocha":"^2.5.3","regenerate":"^1.2.1","requirejs":"^2.1.16"},"gitHead":"cb894eb42f27c8d3cd793f16afe35b3ab38000a1","_id":"cssesc@3.0.0","_nodeVersion":"10.4.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==","shasum":"37741919903b868565e1c09ea747445cd18983ee","tarball":"http://registry-npm.ywwl.com/cssesc/download/cssesc-3.0.0.tgz","fileCount":6,"unpackedSize":17488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWGmMCRA9TVsSAnZWagAA0ZUP/2X5oRTLBf7/sRYddb5U\nNKaRImbd1ZH/zItL1jx31ddvbTalHpGgtt4/GvEN1ajR37EU+9XJx1fma9VA\nB1Uh5r+Rr2NRuIBK5Dl+QJKLmadPdnVM5NlId1SZckX+quib2VE/sI4J8N75\nvf994TBYFKgFj/DETnETcqQL5s0RR4AyzaGuLgoOfP21DbkPmo3cmmcizDH5\ngs4znbEdQsXWxTqKVvrVq0OuDrW/AsdYv65mKUm0pgP0u1q3fOg2CACTv+gK\naI033Vq38XSMQqoLYHcyF8pz9nS+wPxdeVEXPBGS6lSsd3fgAmXByFVo6xoX\n6wADEcDliasLfr7U5V1u0S4HX9n9wq9US9GtD8/bIWOfLMknz5Vj8wHSy7Gc\nPwY5VT2sBCiN23eiwBDLgkYxlSqh5HbY62q5aGGtvU+vcxyEZEBUo60DRQc7\n2FuMW2tvENnsqlj3qzfte3L4pJ/a88mq29HjHKbx0GPCbwVWt63wl6zzBvSZ\nQQMNdpovpJezFZGk6POUL2Zhn9vZpkUkSF+ZiTCkI0+7m5Fkfxsswe4j0Cb5\n9LxgkKBpuFgNbH1+/7WA14BQx5TVZW3mW1ogAzts1Na9f9cQ6YFQTX/D9j5f\nMB/FoiodBzY0kvwn5kwH1ax1W90q3yI382gLkKzC6EAHawn7hpAr6UB5//96\nzg/w\r\n=aPMg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcpM3YcTxf6djwFrOszohV3+g+qzwwpwJ9O21dK7EWyAIgVV/7O5qeDpX2dJ6Cn3sIxLhXTfLEUF/jmf+cl1YZO04="}],"size":6495,"noattachment":false,"key":"/cssesc/-/cssesc-3.0.0.tgz"},"maintainers":[{"name":"mathias","email":"mathias@qiwi.be"}],"_npmUser":{"name":"mathias","email":"mathias@qiwi.be"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cssesc_3.0.0_1549298060123_0.3791149152663338"},"_hasShrinkwrap":false,"readme":"# cssesc [![Build status](https://travis-ci.org/mathiasbynens/cssesc.svg?branch=master)](https://travis-ci.org/mathiasbynens/cssesc) [![Code coverage status](https://img.shields.io/codecov/c/github/mathiasbynens/cssesc.svg)](https://codecov.io/gh/mathiasbynens/cssesc)\n\nA JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.\n\nThis is a JavaScript library for [escaping text for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](https://mothereff.in/css-escapes)\n\n[A polyfill for the CSSOM `CSS.escape()` method is available in a separate repository.](https://mths.be/cssescape) (In comparison, _cssesc_ is much more powerful.)\n\nFeel free to fork if you see possible improvements!\n\n## Installation\n\nVia [npm](https://www.npmjs.com/):\n\n```bash\nnpm install cssesc\n```\n\nIn a browser:\n\n```html\n<script src=\"cssesc.js\"></script>\n```\n\nIn [Node.js](https://nodejs.org/):\n\n```js\nconst cssesc = require('cssesc');\n```\n\nIn Ruby using [the `ruby-cssesc` wrapper gem](https://github.com/borodean/ruby-cssesc):\n\n```bash\ngem install ruby-cssesc\n```\n\n```ruby\nrequire 'ruby-cssesc'\nCSSEsc.escape('I ♥ Ruby', is_identifier: true)\n```\n\nIn Sass using [`sassy-escape`](https://github.com/borodean/sassy-escape):\n\n```bash\ngem install sassy-escape\n```\n\n```scss\nbody {\n  content: escape('I ♥ Sass', $is-identifier: true);\n}\n```\n\n## API\n\n### `cssesc(value, options)`\n\nThis function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes).\n\n```js\ncssesc('Ich ♥ Bücher');\n// → 'Ich \\\\2665  B\\\\FC cher'\n\ncssesc('foo 𝌆 bar');\n// → 'foo \\\\1D306  bar'\n```\n\nBy default, `cssesc` returns a string that can be used as part of a CSS string. If the target is a CSS identifier rather than a CSS string, use the `isIdentifier: true` setting (see below).\n\nThe optional `options` argument accepts an object with the following options:\n\n#### `isIdentifier`\n\nThe default value for the `isIdentifier` option is `false`. This means that the input text will be escaped for use in a CSS string literal. If you want to use the result as a CSS identifier instead (in a selector, for example), set this option to `true`.\n\n```js\ncssesc('123a2b');\n// → '123a2b'\n\ncssesc('123a2b', {\n  'isIdentifier': true\n});\n// → '\\\\31 23a2b'\n```\n\n#### `quotes`\n\nThe default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input text will be escaped as `\\'`, so that the output can be used in a CSS string literal wrapped in single quotes.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.');\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n// → \"Lorem ipsum \\\"dolor\\\" sit \\\\'amet\\\\' etc.\"\n\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'single'\n});\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n// → \"Lorem ipsum \\\"dolor\\\" sit \\\\'amet\\\\' etc.\"\n```\n\nIf you want to use the output as part of a CSS string literal wrapped in double quotes, set the `quotes` option to `'double'`.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'double'\n});\n// → 'Lorem ipsum \\\\\"dolor\\\\\" sit \\'amet\\' etc.'\n// → \"Lorem ipsum \\\\\\\"dolor\\\\\\\" sit 'amet' etc.\"\n```\n\n#### `wrap`\n\nThe `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid CSS string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'single',\n  'wrap': true\n});\n// → '\\'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.\\''\n// → \"\\'Lorem ipsum \\\"dolor\\\" sit \\\\\\'amet\\\\\\' etc.\\'\"\n\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n  'quotes': 'double',\n  'wrap': true\n});\n// → '\"Lorem ipsum \\\\\"dolor\\\\\" sit \\'amet\\' etc.\"'\n// → \"\\\"Lorem ipsum \\\\\\\"dolor\\\\\\\" sit \\'amet\\' etc.\\\"\"\n```\n\n#### `escapeEverything`\n\nThe `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols.\n\n```js\ncssesc('lolwat\"foo\\'bar', {\n  'escapeEverything': true\n});\n// → '\\\\6C\\\\6F\\\\6C\\\\77\\\\61\\\\74\\\\\"\\\\66\\\\6F\\\\6F\\\\\\'\\\\62\\\\61\\\\72'\n// → \"\\\\6C\\\\6F\\\\6C\\\\77\\\\61\\\\74\\\\\\\"\\\\66\\\\6F\\\\6F\\\\'\\\\62\\\\61\\\\72\"\n```\n\n#### Overriding the default options globally\n\nThe global default settings can be overridden by modifying the `css.options` object. This saves you from passing in an `options` object for every call to `encode` if you want to use the non-default setting.\n\n```js\n// Read the global default setting for `escapeEverything`:\ncssesc.options.escapeEverything;\n// → `false` by default\n\n// Override the global default setting for `escapeEverything`:\ncssesc.options.escapeEverything = true;\n\n// Using the global default setting for `escapeEverything`, which is now `true`:\ncssesc('foo © bar ≠ baz 𝌆 qux');\n// → '\\\\66\\\\6F\\\\6F\\\\ \\\\A9\\\\ \\\\62\\\\61\\\\72\\\\ \\\\2260\\\\ \\\\62\\\\61\\\\7A\\\\ \\\\1D306\\\\ \\\\71\\\\75\\\\78'\n```\n\n### `cssesc.version`\n\nA string representing the semantic version number.\n\n### Using the `cssesc` binary\n\nTo use the `cssesc` binary in your shell, simply install cssesc globally using npm:\n\n```bash\nnpm install -g cssesc\n```\n\nAfter that you will be able to escape text for use in CSS strings or identifiers from the command line:\n\n```bash\n$ cssesc 'föo ♥ bår 𝌆 baz'\nf\\F6o \\2665  b\\E5r \\1D306  baz\n```\n\nIf the output needs to be a CSS identifier rather than part of a string literal, use the `-i`/`--identifier` option:\n\n```bash\n$ cssesc --identifier 'föo ♥ bår 𝌆 baz'\nf\\F6o\\ \\2665\\ b\\E5r\\ \\1D306\\ baz\n```\n\nSee `cssesc --help` for the full list of options.\n\n## Support\n\nThis library supports the Node.js and browser versions mentioned in [`.babelrc`](https://github.com/mathiasbynens/cssesc/blob/master/.babelrc). For a version that supports a wider variety of legacy browsers and environments out-of-the-box, [see v0.1.0](https://github.com/mathiasbynens/cssesc/releases/tag/v0.1.0).\n\n## Author\n\n| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](https://mathiasbynens.be/) |\n\n## License\n\nThis library is available under the [MIT](https://mths.be/mit) license.\n","publish_time":1549298060250,"_cnpm_publish_time":1549298060250,"dist-tags":{"latest":"3.0.0"}}