{"id":20302385,"url":"https://github.com/mrminfive/babel-plugin-vue-jsx-scoped-css","last_synced_at":"2025-04-11T13:40:44.122Z","repository":{"id":35142986,"uuid":"211788758","full_name":"Mrminfive/babel-plugin-vue-jsx-scoped-css","owner":"Mrminfive","description":":hammer: CSS encapsulation solution for Vue JSX","archived":false,"fork":false,"pushed_at":"2023-01-04T11:57:21.000Z","size":1707,"stargazers_count":3,"open_issues_count":30,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T22:21:35.992Z","etag":null,"topics":["scoped-css","vue","vue-jsx"],"latest_commit_sha":null,"homepage":"","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/Mrminfive.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":"2019-09-30T06:16:58.000Z","updated_at":"2024-02-01T12:33:28.000Z","dependencies_parsed_at":"2023-01-15T14:45:44.545Z","dependency_job_id":null,"html_url":"https://github.com/Mrminfive/babel-plugin-vue-jsx-scoped-css","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrminfive%2Fbabel-plugin-vue-jsx-scoped-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrminfive%2Fbabel-plugin-vue-jsx-scoped-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrminfive%2Fbabel-plugin-vue-jsx-scoped-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mrminfive%2Fbabel-plugin-vue-jsx-scoped-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mrminfive","download_url":"https://codeload.github.com/Mrminfive/babel-plugin-vue-jsx-scoped-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224653461,"owners_count":17347562,"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":["scoped-css","vue","vue-jsx"],"created_at":"2024-11-14T16:31:08.856Z","updated_at":"2024-11-14T16:31:09.645Z","avatar_url":"https://github.com/Mrminfive.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-vue-jsx-scoped-css\n\n\u003cp align=\"left\"\u003e\n    \u003ca href=\"https://npmcharts.com/compare/babel-plugin-vue-jsx-scoped-css?minimal=true\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/babel-plugin-vue-jsx-scoped-css.svg\" alt=\"Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/babel-plugin-vue-jsx-scoped-css\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/babel-plugin-vue-jsx-scoped-css.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/babel-plugin-vue-jsx-scoped-css\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/babel-plugin-vue-jsx-scoped-css.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n:hammer: CSS encapsulation solution for Vue JSX\n\n## About\n\nThis plugin is used to implement the css scoped effect of template in vue jsx。\n\nFor more details, please refer to [react-scoped-css][reactscopedcss]\n\n## Use\n\nYou have to add one babel plugin and one webpack loader.\n\n### Babel\n\n```bash\nyarn add babel-plugin-vue-jsx-scoped-css --dev\n```\n\nand in your babelrc add\n\n```json\n{\n    \"presets\": [\"@vue/babel-preset-jsx\"],\n    \"plugins\": [\"babel-plugin-vue-jsx-scoped-css\"]\n}\n```\n\nalso note that you can define your own matching rule like this\n\n```json\n{\n    \"plugins\": [\n        [\n            \"babel-plugin-vue-jsx-scoped-css\",\n            {\n                \"include\": \".local.(sa|sc|c)ss$\"\n            }\n        ]\n    ]\n}\n```\n\n**This plugin must be before the vue jsx parsing plugin.**\n\n### Webpack\n\n```bash\nyarn add scoped-css-loader --dev\n```\n\nand in your webpack.config.js\n\n```json\n{\n    \"test\": /\\.(sc|c|sa)ss$/,\n    \"use\": [\n        {\n            \"loader\": \"style-loader\"\n        },\n        {\n            \"loader\": \"css-loader\",\n            \"options\": {\n                \"sourceMap\": true,\n                \"importLoaders\": 2\n            }\n        },\n        // You have to put in after `css-loader` and before any `pre-precessing loader`\n        { \"loader\": \"scoped-css-loader\" },\n        {\n            \"loader\": \"sass-loader\"\n        }\n    ]\n}\n```\n\n[reactscopedcss]: https://github.com/gaoxiaoliangz/react-scoped-css\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrminfive%2Fbabel-plugin-vue-jsx-scoped-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrminfive%2Fbabel-plugin-vue-jsx-scoped-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrminfive%2Fbabel-plugin-vue-jsx-scoped-css/lists"}