{"id":15608672,"url":"https://github.com/hypercubed/copy-styles","last_synced_at":"2025-03-29T14:25:30.825Z","repository":{"id":57207284,"uuid":"44508045","full_name":"Hypercubed/copy-styles","owner":"Hypercubed","description":"Copies computed styles from source to target","archived":false,"fork":false,"pushed_at":"2015-11-24T09:51:22.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T15:25:25.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hypercubed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-19T02:58:47.000Z","updated_at":"2021-08-04T17:10:08.000Z","dependencies_parsed_at":"2022-09-11T05:30:28.924Z","dependency_job_id":null,"html_url":"https://github.com/Hypercubed/copy-styles","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hypercubed%2Fcopy-styles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hypercubed%2Fcopy-styles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hypercubed%2Fcopy-styles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hypercubed%2Fcopy-styles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hypercubed","download_url":"https://codeload.github.com/Hypercubed/copy-styles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246194913,"owners_count":20738761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T05:21:51.689Z","updated_at":"2025-03-29T14:25:30.809Z","avatar_url":"https://github.com/Hypercubed.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# computed-style\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Downloads][download-badge]][npm-url]\n\nCopies computed styles from source DOM Element to target DOM Element as inline styles.\n\n## Install\n\n```sh\nnpm install Hypercubed/copy-styles\n```\n\n## Usage\n\n```js\nimport copyStyles from 'copy-styles';\n\nconst source = document.querySelector('#node1');\nconst target = document.querySelector('#node1');\n\ncopyStyles(source, target);\n```\n\n#### Styles object\n\nAn optional third parameter can be passed to `copyStyles`.  If true all computed styles are copied.  If false no styles are copied (function has no effect).  If the third parameter is an object only those keys with a truthy value are copied. If a value is false or equal to the value of the that property it will not be copied.  For example:\n\n```js\ncopyStyles(source, target, {\n\t'color': true,\n\t'font-family': false,\n\t'margin-left': '0px'\n});\n```\n\nIn this case, the `color` style will be copied, `font-family` will not (same result if `font-family` is absent), `margin-left` will only be copied if not equal to '0px'.\n\nSee [API](API.md)\n\n## License\n\nMIT © [J. Harshbarger](http://github.com/Hypercubed)\n\n[npm-url]: https://npmjs.org/package/copy-styles\n[npm-image]: https://img.shields.io/npm/v/copy-styles.svg?style=flat-square\n\n[travis-url]: https://travis-ci.org/Hypercubed/copy-styles\n[travis-image]: https://img.shields.io/travis/Hypercubed/copy-styles.svg?style=flat-square\n\n[download-badge]: http://img.shields.io/npm/dm/copy-styles.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypercubed%2Fcopy-styles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypercubed%2Fcopy-styles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypercubed%2Fcopy-styles/lists"}