{"id":18601824,"url":"https://github.com/yyued/svg-skeleton","last_synced_at":"2025-10-30T11:20:35.157Z","repository":{"id":57375559,"uuid":"117643706","full_name":"yyued/SVG-Skeleton","owner":"yyued","description":"Create the skeleton screen through SVG element","archived":false,"fork":false,"pushed_at":"2018-01-31T02:14:00.000Z","size":1452,"stargazers_count":165,"open_issues_count":0,"forks_count":21,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-24T14:20:12.872Z","etag":null,"topics":["javascript"],"latest_commit_sha":null,"homepage":"https://svg-skeleton.js.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yyued.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-16T06:51:19.000Z","updated_at":"2024-03-29T04:04:22.000Z","dependencies_parsed_at":"2022-09-12T16:04:12.817Z","dependency_job_id":null,"html_url":"https://github.com/yyued/SVG-Skeleton","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyued%2FSVG-Skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyued%2FSVG-Skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyued%2FSVG-Skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyued%2FSVG-Skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yyued","download_url":"https://codeload.github.com/yyued/SVG-Skeleton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230527866,"owners_count":18240051,"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":["javascript"],"created_at":"2024-11-07T02:09:28.606Z","updated_at":"2025-10-30T11:20:35.106Z","avatar_url":"https://github.com/yyued.png","language":"JavaScript","readme":"\u003ch1 align=\"center\"\u003e SVG-Skeleton \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg alt=\"Licence\" src=\"https://img.shields.io/badge/license-MIT-green.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.org/package/svg-skeleton\"\u003e\n        \u003cimg alt=\"NPM\" src=\"https://img.shields.io/badge/npm-v0.0.4-brightgreen.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"\"\u003e\n        \u003cimg alt=\"Size\" src=\"https://img.shields.io/badge/size-2kb-blue.svg\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Why\n\nSkeletal screen, we are no stranger to, and the biggest existence of the skeletal screen is due to the page rendering out of content for a long time, and use it to occupy the page, users to reduce the time to perceive white screen.\n\nIf the skeletal screen depend on core frameworks such as React / Vue, it will inevitably first need to parse the core library before rendering to the skeletal screen, which is undoubtedly not the best choice.\n\n**SVG-Skeleton** is exactly what we've been looking for.\n\nBy SVG elements to describe the placeholder elements of the skeletal diagram, support JSX write SVG indifference, reuse SVG fragments, component-based mode.\n\n[简体中文](./README.zh-CN.md)\n\n## Installing\n\n```sh\nnpm i svg-skeleton --save\n```\n\nor\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/svg-skeleton/dist/svg-skeleton.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### JSX Code\n\n```js\nimport SVGSkeleton from 'svg-skeleton';\n\nconst { h, render } = SVGSkeleton;\n\n// inside #shining animation\nconst Item = (\n    \u003csvg width=\"750\" height=\"191\"\u003e\n        \u003ccircle cx=\"95\" cy=\"102\" r=\"63\" fill=\"#edeff0\" mask=\"url(#shining)\" /\u003e\n        \u003crect width=\"160\" height=\"35\" x=\"190\" y=\"45\" fill=\"#edeff0\" mask=\"url(#shining)\" /\u003e\n        \u003crect width=\"400\" height=\"35\" x=\"190\" y=\"90\" fill=\"#edeff0\" mask=\"url(#shining)\" /\u003e\n        \u003cline x1=\"0\" y1=\"190\" x2=\"750\" y2=\"190\" stroke=\"#edeff0\"\u003e\u003c/line\u003e\n    \u003c/svg\u003e\n);\n\nconst Page = ( ( ) =\u003e {\n    let List = [ ];\n\n    for ( let i = 0; i \u003c 6; i++ ) {\n        List.push( ( \u003cItem y={ i == 0 ? 0 : i * 191 } /\u003e ) );\n    }\n\n    return (\n        \u003csvg width=\"750\" height=\"1334\" fill=\"#fafafa\"\u003e\n            { List }\n        \u003c/svg\u003e\n    );\n} )( );\n\nrender( Page,  document.body );\n```\n\n### Output\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./README/1.gif\" width=\"250px\"\u003e\n\u003c/p\u003e\n\n## Diff\n\nIn order to try to position the elements of the bone screen the same as the design draft, you need the Diff function.\n\n### Code\n\n```js\nconst { diff } = SVGSkeleton;\n\nrender( diff( Page, require('./list.png') ),  document.body );\n```\n\n### Output\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./README/2.gif\" width=\"250px\"\u003e\n\u003c/p\u003e\n\n## Depend on [JSX \u0026 h](https://www.npmjs.com/package/babel-plugin-transform-react-jsx)\n\nthe setting will be similar to\n\n```json\n{\n    \"plugins\": [\n        [ \"transform-react-jsx\", { \"pragma\": \"h\" } ]\n    ]\n}\n```\n\n## License\n\n[MIT](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyued%2Fsvg-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyyued%2Fsvg-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyued%2Fsvg-skeleton/lists"}