{"_id":"computed-style-to-inline-style","_rev":"14-00c0eb420ef0b994b0452592312d3f3d","name":"computed-style-to-inline-style","description":"Convert a HTML element's computed CSS to inline CSS.","dist-tags":{"latest":"4.0.0"},"versions":{"1.0.0":{"name":"computed-style-to-inline-style","version":"1.0.0","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Swinburne Software Innovation Lab"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ssilab/computed-style-to-inline-style.git"},"bugs":{"url":"https://github.com/ssilab/computed-style-to-inline-style/issues"},"main":"./index.js","scripts":{},"dependencies":{},"devDependencies":{},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"8de47fe6addaa7a4106a1ec9631b28630388b90e","homepage":"https://github.com/ssilab/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@1.0.0","_shasum":"fce9022926098a64e31e12a7d990a024d1e65f97","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.12.2","_npmUser":{"name":"ssil","email":"god@ssil.com.au"},"dist":{"shasum":"fce9022926098a64e31e12a7d990a024d1e65f97","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-1.0.0.tgz","integrity":"sha512-3GhhWYq9hp3M8HhD/eEiD62BNPkQfW4+iNRsuar+4MF7aaHEc2uUipxGPtv9EfnKL4ZR/3ezgR6uNwcmjemavg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByMdY7NbDNNmAKAY3yXdnzfFmGX/sXX+wLCa7DcCWnGAiEA9Qk13oA1UkfOB6ER3WCCqyS0B3aLoKbr7YCK6xYLiOk="}]},"maintainers":[{"name":"ssil","email":"god@ssil.com.au"}],"directories":{}},"1.0.1":{"name":"computed-style-to-inline-style","version":"1.0.1","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Swinburne Software Innovation Lab"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ssilab/computed-style-to-inline-style.git"},"bugs":{"url":"https://github.com/ssilab/computed-style-to-inline-style/issues"},"main":"./index.js","scripts":{},"dependencies":{},"devDependencies":{},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"8bdc23f86b5230dfa5ee8da7466dba1dd62fe06e","homepage":"https://github.com/ssilab/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@1.0.1","_shasum":"e9e01fca1237849fd3a6d79a64dc73d632c7a23e","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.12.2","_npmUser":{"name":"ssil","email":"god@ssil.com.au"},"dist":{"shasum":"e9e01fca1237849fd3a6d79a64dc73d632c7a23e","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-1.0.1.tgz","integrity":"sha512-pBphbl+RULLA++XYCpzZAT+7gWPk/aFAE9kpg0Rp5ohr2qpLxeAXZVSyOT6YA/cw0/A3lJsKgx2BbJlnNJ6yzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDrzaPR/gETMBzo2RnES4OXcRRuJR+a0zZ9JV3U94PIcAiBO54qMKjTN/JEzp1Ju19mW3bVY8kZZuHn9W+h5cyRyDQ=="}]},"maintainers":[{"name":"ssil","email":"god@ssil.com.au"}],"directories":{}},"1.0.2":{"name":"computed-style-to-inline-style","version":"1.0.2","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Swinburne Software Innovation Lab"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ssilab/computed-style-to-inline-style.git"},"bugs":{"url":"https://github.com/ssilab/computed-style-to-inline-style/issues"},"main":"./index.js","scripts":{},"dependencies":{},"devDependencies":{},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"38d8b3c6da53c9f878eb2a3c6a9dd94cedc2195c","homepage":"https://github.com/ssilab/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@1.0.2","_shasum":"af92be00281ecc03d5cde88b4eefc0d2c36aeef6","_from":".","_npmVersion":"2.11.0","_nodeVersion":"0.12.4","_npmUser":{"name":"ssil","email":"god@ssil.com.au"},"maintainers":[{"name":"ssil","email":"god@ssil.com.au"}],"dist":{"shasum":"af92be00281ecc03d5cde88b4eefc0d2c36aeef6","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-1.0.2.tgz","integrity":"sha512-J0+9mFiE4jmBssFjFx1hhlVrSwtv0NbrpSZoCI7SHZN1EHW0aPgTJjN9qcAu46FCIU+cr7FpyisAEMUD1Wf6kQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCytBtbfByAJN4gEi1Drc4PXu//8YMlfcH/P1pMHaGXXQIhAIGk9B+dKvttiSonx3rNjf0wi14BD/0oB6wUUm572t9H"}]},"directories":{}},"1.1.0":{"name":"computed-style-to-inline-style","version":"1.1.0","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Swinburne Software Innovation Lab"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ssilab/computed-style-to-inline-style.git"},"bugs":{"url":"https://github.com/ssilab/computed-style-to-inline-style/issues"},"main":"./index.js","scripts":{"precommit":"npm test","prepush":"npm test","test":"phantomjs test.js"},"dependencies":{},"devDependencies":{"husky":"0.10.2","phantomjs":"1.9.18"},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"a33a876d9bc67a84f84763da761169c69bf6dd5b","homepage":"https://github.com/ssilab/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@1.1.0","_shasum":"b5fac2e0bdaf9b42ddd9bdb574651ecbad00ae3a","_from":".","_npmVersion":"3.4.0","_nodeVersion":"4.2.1","_npmUser":{"name":"ssil","email":"god@ssil.com.au"},"dist":{"shasum":"b5fac2e0bdaf9b42ddd9bdb574651ecbad00ae3a","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-1.1.0.tgz","integrity":"sha512-yZ9DkUAcuc8Kor08MPSFOLHzpCYh9XD1IJV2woZgLMvmpbs5+3mFP+G5cIWEAgq3juctTJa48OXT1yqop6UUrQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBySe9tAyl5FMTTPUPapPl1N3KKbAruf2292YHVmWkShAiAG6yPWxLN4FUsYLewqUke7HKPaYPOqFKaXkoAtcPWIMA=="}]},"maintainers":[{"name":"ssil","email":"god@ssil.com.au"}],"directories":{}},"1.1.1":{"name":"computed-style-to-inline-style","version":"1.1.1","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Luke Horvat"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lukehorvat/computed-style-to-inline-style.git"},"bugs":{"url":"https://github.com/lukehorvat/computed-style-to-inline-style/issues"},"main":"./index.js","scripts":{"precommit":"npm test","prepush":"npm test","test":"phantomjs test.js"},"dependencies":{},"devDependencies":{"husky":"0.10.2","phantomjs":"1.9.18"},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"de61bb8d8a6a3e4dcfeb65360138a7c9d0c951a6","homepage":"https://github.com/lukehorvat/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@1.1.1","_shasum":"85bfd731ce192272caaa653fdc08ada3392fb5ad","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"lukehorvat","email":"lukehorvat@gmail.com"},"dist":{"shasum":"85bfd731ce192272caaa653fdc08ada3392fb5ad","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-1.1.1.tgz","integrity":"sha512-WY5J9CRak0i2t6fu2MJHTxMF9Urj6HN97PfOLSaC7Vk7pNcbQOPK+y0JXLM6PIJP9dfL7M/aP5rf4H998AmoYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG8VXGeV9j4EtrR3xujWudnb3GLLT0q0hFMJT/ZoyqHKAiB+/mtTOj72V4KWDsylAtMNvE9UG8Dia0bTpEikLd8b4A=="}]},"maintainers":[{"name":"lukehorvat","email":"lukehorvat@gmail.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/computed-style-to-inline-style-1.1.1.tgz_1455687947823_0.019972014939412475"},"directories":{}},"2.0.0":{"name":"computed-style-to-inline-style","version":"2.0.0","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Luke Horvat"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lukehorvat/computed-style-to-inline-style.git"},"main":"index.js","scripts":{"test":"electron test.html"},"dependencies":{},"devDependencies":{"electron":"1.7.9"},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"a633daf92167041c4c315401085ac45597fdd7c0","bugs":{"url":"https://github.com/lukehorvat/computed-style-to-inline-style/issues"},"homepage":"https://github.com/lukehorvat/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@2.0.0","_shasum":"baf68a853e9cff8784ae59acabc597dfa0492f63","_from":".","_npmVersion":"4.6.1","_nodeVersion":"8.4.0","_npmUser":{"name":"lukehorvat","email":"lukehorvat@gmail.com"},"dist":{"shasum":"baf68a853e9cff8784ae59acabc597dfa0492f63","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-2.0.0.tgz","integrity":"sha512-SzA5JG36MCK7d6xUMkuR2Oyc/bxKJI/BXFFcGurRzldpQJX6hsgOmOI055fwYsCHYSZ/clyX5joIQKZ9AwfU8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEFYBVqDP1X9yXcF1XDN4VQqE5mA88pQ2CoPRo+xlAHhAiARi/EgI5ENylfCASP8HoH8pFgY/K4fN5WR7OMkhtRV3A=="}]},"maintainers":[{"name":"lukehorvat","email":"lukehorvat@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/computed-style-to-inline-style-2.0.0.tgz_1508356502167_0.5451352235395461"},"directories":{}},"3.0.0":{"name":"computed-style-to-inline-style","version":"3.0.0","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Luke Horvat"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lukehorvat/computed-style-to-inline-style.git"},"main":"dist","scripts":{"build":"babel lib -d dist -q","prebuild":"rimraf dist","prepublish":"npm run build","pretest":"npm run build","test":"electron test/index.html"},"dependencies":{},"devDependencies":{"babel-cli":"6.26.0","babel-plugin-transform-es2015-modules-umd":"6.24.1","babel-plugin-transform-function-bind":"6.22.0","babel-preset-env":"1.7.0","electron":"1.7.9","rimraf":"2.6.2"},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"babel":{"presets":[["env",{"targets":{"browsers":"ie >= 9"}}]],"plugins":[["transform-es2015-modules-umd",{"globals":{"index":"computedStyleToInlineStyle"},"exactGlobals":true}],"transform-function-bind"]},"gitHead":"f502a629a9a7e5959ecf9f4ee2b8f61c552b0b0c","bugs":{"url":"https://github.com/lukehorvat/computed-style-to-inline-style/issues"},"homepage":"https://github.com/lukehorvat/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@3.0.0","_shasum":"9251024463c555c7e1768d77a19eba9b8f418afc","_from":".","_npmVersion":"4.6.1","_nodeVersion":"9.8.0","_npmUser":{"name":"lukehorvat","email":"lukehorvat@gmail.com"},"dist":{"shasum":"9251024463c555c7e1768d77a19eba9b8f418afc","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-3.0.0.tgz","fileCount":5,"unpackedSize":5903,"integrity":"sha512-6XAOG2ZZkpCfbM9AhRN4/wjMgQujtH/2q/eowZON190oAASUjEb3jwcodjmRlR8HNDMahJdBQwchuDftOtF7eg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+AOKiy7QFyjSV8bquUx6LGYliOK3zM8btriNtM+VbRgIhAMZg+uIheFkBQPCRAusteBWJzedm7tQQnLO/dkc1CQA1"}]},"maintainers":[{"name":"lukehorvat","email":"lukehorvat@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/computed-style-to-inline-style_3.0.0_1532633936222_0.7054867907954543"},"_hasShrinkwrap":false},"4.0.0":{"name":"computed-style-to-inline-style","version":"4.0.0","description":"Convert a HTML element's computed CSS to inline CSS.","author":{"name":"Luke Horvat"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/lukehorvat/computed-style-to-inline-style.git"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"webpack --mode production","test":"electron test/main.js","pretest":"npm run build"},"dependencies":{},"devDependencies":{"electron":"^26.1.0","rimraf":"^4.1.2","ts-loader":"^9.4.1","typescript":"^5.1.6","webpack":"^5.75.0","webpack-cli":"^4.10.0"},"keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"gitHead":"4cecdaffafc34b949456687a410da09fdadd4846","bugs":{"url":"https://github.com/lukehorvat/computed-style-to-inline-style/issues"},"homepage":"https://github.com/lukehorvat/computed-style-to-inline-style#readme","_id":"computed-style-to-inline-style@4.0.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-PwVJVqD1SZnDVbEJrshRARbKUq9JG2SlkkEY8NacLpRz98FemLfdZw3vjHndjP5gHvOruxg6Ywhcs2kqD2EmEw==","shasum":"7cde437a727818fa37ec75c082a0efbfa5fffbdf","tarball":"https://registry.npmjs.org/computed-style-to-inline-style/-/computed-style-to-inline-style-4.0.0.tgz","fileCount":5,"unpackedSize":5096,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCucmKLiVhvUrI2dIwUFZmKLgZnQu0Spgdho6++z0An+wIgeNDT0/XyPBkbk0QjdxYq78//fqc30Sb1+oGHB0ub1AE="}]},"_npmUser":{"name":"lukehorvat","email":"lukehorvat@gmail.com"},"directories":{},"maintainers":[{"name":"lukehorvat","email":"lukehorvat@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/computed-style-to-inline-style_4.0.0_1693257219740_0.9330122017868401"},"_hasShrinkwrap":false}},"readme":"# computed-style-to-inline-style [![npm version](https://img.shields.io/npm/v/computed-style-to-inline-style.svg?style=flat-square)](https://www.npmjs.org/package/computed-style-to-inline-style)\n\nConvert a HTML element's computed CSS to inline CSS.\n\nUses [Window.getComputedStyle](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) internally.\n\n## Installation\n\nInstall the package via npm:\n\n```sh\n$ npm install computed-style-to-inline-style\n```\n\nOr download it from the unpkg CDN:\n\n```html\n<script src=\"https://unpkg.com/computed-style-to-inline-style\"></script>\n```\n\n## Usage\n\nExample:\n\n```js\nimport computedStyleToInlineStyle from 'computed-style-to-inline-style';\n\ncomputedStyleToInlineStyle(document.body, {\n  recursive: true,\n  properties: ['font-size', 'text-decoration'],\n});\n```\n\n## API\n\n### computedStyleToInlineStyle(element, [options])\n\nA function that iterates through the computed style properties of `element` and redefines them as inline styles.\n\n#### element\n\nAn HTML element.\n\n#### options\n\nAn (optional) object with any of the following keys defined:\n\n- `recursive` – A boolean indicating whether to recursively process child elements or not. Defaults to `false`.\n- `properties` – An array of property names to operate on; all others are filtered out. Defaults to `undefined` (i.e. _every_ computed style property is redefined as an inline style).\n\n## Why?\n\nConsider a scenario where you're rendering an SVG element in a HTML document, with its pretty styling defined in external stylesheets:\n\n```html\n<svg viewBox=\"0 0 800 600\">...</svg>\n```\n\nYou then add a link to let users download the SVG as a file:\n\n```html\n<a href=\"data:image/svg+xml;base64,...\" download=\"example.svg\">Download</a>\n```\n\nTo your dismay, you find that none of the SVG's pretty styling is preserved when downloaded to disk! This is because the file lacks the original context in which the SVG element was rendered in the browser and has no reference to those nice external stylesheets you wrote.\n\nAs a solution, you use this package to redefine the SVG styling inline, guaranteeing that the element is saved to file with all of its fancy CSS information embedded within:\n\n```js\ncomputedStyleToInlineStyle(svgElement, { recursive: true });\n```\n","maintainers":[{"name":"lukehorvat","email":"lukehorvat@gmail.com"}],"time":{"modified":"2023-08-28T21:13:40.143Z","created":"2015-06-03T16:07:03.459Z","1.0.0":"2015-06-03T16:07:03.459Z","1.0.1":"2015-06-03T16:36:01.688Z","1.0.2":"2015-06-09T04:33:53.162Z","1.1.0":"2015-11-19T22:54:03.245Z","1.1.1":"2016-02-17T05:45:49.834Z","2.0.0":"2017-10-18T19:55:02.231Z","3.0.0":"2018-07-26T19:38:56.291Z","4.0.0":"2023-08-28T21:13:39.963Z"},"homepage":"https://github.com/lukehorvat/computed-style-to-inline-style#readme","keywords":["css","style","stylesheet","computed","inline","element","html","browser","dom"],"repository":{"type":"git","url":"git+https://github.com/lukehorvat/computed-style-to-inline-style.git"},"author":{"name":"Luke Horvat"},"bugs":{"url":"https://github.com/lukehorvat/computed-style-to-inline-style/issues"},"license":"MIT","readmeFilename":"README.md"}