{"id":14962528,"url":"https://github.com/ryoppippi/svelte-preprocess-import-css","last_synced_at":"2025-10-24T22:32:27.602Z","repository":{"id":251230787,"uuid":"836782197","full_name":"ryoppippi/svelte-preprocess-import-css","owner":"ryoppippi","description":"Svelte preprocessor to import scoped CSS files into Component","archived":false,"fork":false,"pushed_at":"2025-02-01T09:04:25.000Z","size":49,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T10:18:54.700Z","etag":null,"topics":["svelte","svelte-preprocess","svelte-preprocessor"],"latest_commit_sha":null,"homepage":"https://jsr.io/@ryoppippi/svelte-preprocess-import-css","language":"TypeScript","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/ryoppippi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ryoppippi"}},"created_at":"2024-08-01T14:44:40.000Z","updated_at":"2025-01-27T23:26:47.000Z","dependencies_parsed_at":"2024-09-13T20:07:50.085Z","dependency_job_id":"b0005733-6e8a-4ace-a5d3-aa61d9ce3dbe","html_url":"https://github.com/ryoppippi/svelte-preprocess-import-css","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":"0.10344827586206895","last_synced_commit":"d416a0a61102e6a1fc003d2d5b440e0c26ffa3e3"},"previous_names":["ryoppippi/svelte-preprocess-import-scoped-css"],"tags_count":11,"template":false,"template_full_name":"ryoppippi/deno-jsr-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryoppippi%2Fsvelte-preprocess-import-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryoppippi%2Fsvelte-preprocess-import-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryoppippi%2Fsvelte-preprocess-import-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryoppippi%2Fsvelte-preprocess-import-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryoppippi","download_url":"https://codeload.github.com/ryoppippi/svelte-preprocess-import-css/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238043943,"owners_count":19407117,"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":["svelte","svelte-preprocess","svelte-preprocessor"],"created_at":"2024-09-24T13:29:54.608Z","updated_at":"2025-10-24T22:32:27.231Z","avatar_url":"https://github.com/ryoppippi.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ryoppippi"],"categories":[],"sub_categories":[],"readme":"# svelte-preprocess-import-css\n\n[![JSR](https://jsr.io/badges/@ryoppippi/svelte-preprocess-import-css)](https://jsr.io/@ryoppippi/svelte-preprocess-import-css)\n[![JSR](https://jsr.io/badges/@ryoppippi/svelte-preprocess-import-css/score)](https://jsr.io/@ryoppippi/svelte-preprocess-import-css)\n\nThis is a Svelte preprocessor that allows you to import scoped CSS files into your Svelte components.\nBased on [this issue](https://github.com/sveltejs/svelte/issues/7125#issuecomment-1528965643)\n\n## Usage\n\nYou can add it to your `svelte.config.js`, then add it to the preprocessor list:\n\n```js\nimport { importCSSPreprocess } from '@ryoppippi/svelte-preprocess-import-css';\nexport default {\n  preprocess: [\n    importCSSPreprocess(), // \u003c--\n    svelteAutoPreprocess(),\n  ],\n};\n```\n\nNow you can use `@import \"./whatever.css\" scoped;`.\n\nFor example, the following CSS:\n\n```svelte\n\u003cstyle\u003e\n@import \"./a.css\" scoped;\n@import \"./b.css\" scoped;\n\n.another-style { display: block }\n\u003c/style\u003e\n```\n\nwill get converted into:\n\n```svelte\n\u003cstyle\u003e\ncontents of a.css will be here\ncontents of b.css will be here\n\n.another-style { display: block }\n\u003c/style\u003e\n```\n\n### Select Style Rules by Query Selector\n\nYou can select style rules by query selector.\n\nFor example, the following CSS and Svelte:\n\n\n```css\n/* a.css */\n\ndiv { color: red; }\n\n.message { color: blue; }\n```\n\n```svelte\n\u003cdiv\u003e hello \u003c/div\u003e\n\u003cp class=\"message\"\u003e world \u003c/p\u003e\n\n\u003cstyle\u003e\n@import \"./a.css?.message\" scoped;\n\ndiv { color: green; }\n\u003c/style\u003e\n```\n\nwill get converted into:\n\n```svelte\n\u003cdiv\u003e hello \u003c/div\u003e\n\u003cp class=\"message\"\u003e world \u003c/p\u003e\n\n\u003cstyle\u003e\n.message { color: blue; }\n\ndiv { color: green; }\n\u003c/style\u003e\n```\n\n### Rename Style Rules by Query Selector\n\nYou can rename style rules by query selector.\n\nFor example, the following CSS and Svelte:\n\n```css\n/* a.css */\n\ndiv { color: red; }\n\n.m0 { color: blue; }\n```\n\n```svelte\n\u003cp class=\"m1\"\u003e world \u003c/p\u003e\n\n\u003cstyle\u003e\n@import \"./a.css?.m0=.m1\" scoped;\n\ndiv { color: green; }\n\u003c/style\u003e\n```\n\nwill get converted into:\n\n```svelte\n\u003cp class=\"m1\"\u003e world \u003c/p\u003e\n\n\u003cstyle\u003e\n.m1 { color: blue; }\n\ndiv { color: green; }\n\u003c/style\u003e\n```\n\n## License\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryoppippi%2Fsvelte-preprocess-import-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryoppippi%2Fsvelte-preprocess-import-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryoppippi%2Fsvelte-preprocess-import-css/lists"}