{"dist":{"shasum":"756ec336e5c6d1f1e6cacea0421d0a7d4aac5a84","tarball":"https://registry.npmjs.org/posthtml-rename-id/-/posthtml-rename-id-1.0.4-alpha.0.tgz","fileCount":4,"integrity":"sha512-WeiuQmGhgU0BYYgEc3QN5JpxY/JJU0T0Ay7dZ2mR5VQEox/diIP10oTU5BhbJ2L7CnsWrN7sIwfib0VJv9lItQ==","signatures":[{"sig":"MEQCIEUdvfuTB9/TBHOw+6r0LWsFEI2KsAs25VKyNeDMwREgAiBwy0wIvg8psJxSkMmQ7ZD3poKJBuvr/QOWM2yaAhhINw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4936},"name":"posthtml-rename-id","files":["index.js"],"readme":"# PostHTML rename plugin\n\nPlugin to rename id attributes and it's references. \nInspired by [grunt-svgstore](https://github.com/FWeinb/grunt-svgstore).\n\nHandle following cases:\n\n- `href=\"#id\"` and `xlink:href=\"#id\"`\n- `style` attribute values like `style=\"fill: url(#id)\"`\n- `<style>` tag values like `.selector {fill: url(#id)\"}`\n- any other attribute value like `attr=\"url(#id)\"`\n\n## Install\n\n```sh\nnpm install posthtml-rename-id --save\n```\n\n## Usage\n\n```js\nconst posthtml = require('posthtml');\nconst rename = require('posthtml-rename-id');\n\nposthtml()\n  .use(rename('prefix_[id]'))\n  .process('<div id=\"qwe\"></div> <a href=\"#qwe\"></a>')\n  .then((result) => {\n    console.log(result);\n  });\n\n// <div id=\"prefix_qwe\"></div> <a href=\"#prefix_qwe\"></a>\n```\n\n## Configuration\n\n### `plugin(pattern: string|Function)` (optional, `[id]` by default)\n\nRenaming pattern. `[id]` placeholder can be used as current id of an element.\nIf `pattern` provided as a function it will be called with current id as first argument.\nFunction should return the new id as string (`[id]` can be used as well).\n\nUppercase all ids:\n```js\nposthtml([\n  renameId(id => id.toUpperCase())\n]);\n```\n\nRename all ids to `elem_{counter}`:\n```js\nlet c = 0;\nposthtml([\n  renameId((id) => { c++; return 'elem_' + c; })\n]);\n```\n","license":"MIT","scripts":{"test":"mocha -r $MOCHA_SETUP_PATH"},"_npmUser":{"name":"kisenka","email":"qtuzov@gmail.com"},"repository":{"url":"https://github.com/kisenka/svg-baker/packages/posthtml-rename-id","type":"git"},"_npmVersion":"5.6.0","description":"PostHTML plugin to rename id attributes and it's references","directories":{},"maintainers":[{"name":"kisenka","email":"qtuzov@gmail.com"}],"_nodeVersion":"9.9.0","dependencies":{"escape-string-regexp":"1.0.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/posthtml-rename-id_1.0.4-alpha.0_1523286276992_0.8947259342532718","host":"s3://npm-registry-packages"},"_id":"posthtml-rename-id@1.0.4-alpha.0","version":"1.0.4-alpha.0"}