{"id":30145280,"url":"https://github.com/grawl/unplugin-mantine-autoload-css","last_synced_at":"2026-01-20T17:32:58.446Z","repository":{"id":304328745,"uuid":"1018408846","full_name":"Grawl/unplugin-mantine-autoload-css","owner":"Grawl","description":"Unplugin for Mantine to autoload CSS for used components","archived":false,"fork":false,"pushed_at":"2025-07-24T13:35:03.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-24T15:46:51.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Grawl.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-07-12T07:39:33.000Z","updated_at":"2025-07-24T13:35:07.000Z","dependencies_parsed_at":"2025-07-13T04:15:49.980Z","dependency_job_id":null,"html_url":"https://github.com/Grawl/unplugin-mantine-autoload-css","commit_stats":null,"previous_names":["grawl/unplugin-mantine-autoload-css"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Grawl/unplugin-mantine-autoload-css","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grawl%2Funplugin-mantine-autoload-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grawl%2Funplugin-mantine-autoload-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grawl%2Funplugin-mantine-autoload-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grawl%2Funplugin-mantine-autoload-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Grawl","download_url":"https://codeload.github.com/Grawl/unplugin-mantine-autoload-css/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grawl%2Funplugin-mantine-autoload-css/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269850366,"owners_count":24485177,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-11T08:12:13.421Z","updated_at":"2026-01-20T17:32:58.399Z","avatar_url":"https://github.com/Grawl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unplugin Mantine Autoload CSS\n\n[![NPM Version](https://img.shields.io/npm/v/unplugin-mantine-autoload-css)](https://www.npmjs.com/package/unplugin-mantine-autoload-css)\n\n[Mantine](https://mantine.dev) [Unplugin](https://unplugin.unjs.io/) to autoload CSS for used components\n\n## Usage\n\n`vite.config.ts`\n\n```ts\nimport { defineConfig } from 'vite'\nimport { mantineAutoloadCSS } from 'unplugin-mantine-autoload-css'\nexport default defineConfig({\n\tplugins: [\n\t\tmantineAutoloadCSS(),\n\t]\n})\n```\n\n### Behavior options:\n\n#### `all`: `Boolean` / Default: `false`\n\n\u003e Instead of component detecting, load `@mantine/core/styles.css` for each file with import from `@mantine/core`\n\nHint: If you want to use this plugin only for build optimization, you can use it conditionally:\n\n```ts\nexport default defineConfig(({ mode }) =\u003e ({\n\tplugins: [\n\t\tmantineAutoloadCSS({\n\t\t\tall: mode === 'development',\n\t\t}),\n\t],\n}))\n```\n\n#### `layer`: `Boolean` / Default: `true`\n\n\u003e Switch between `.css` and `.layer.css` files\n\n[Mantine: CSS Layers](https://mantine.dev/styles/mantine-styles/#css-layers)\n\n#### `forced`: `ComponentStylesheetName[]` / Default: `[]`\n\n\u003e Add some components' CSS for each file with import from `@mantine/core`\n\n### [Global styles](https://arc.net/l/quote/caciuwbj) toggles:\n\n#### `baseline`: `Boolean` / Default: `true`\n\n\u003e Load `baseline.css` / `baseline.layer.css` — a minimal CSS reset, sets box-sizing: border-box and changes font properties\n\n#### `defaultCSSVariables`: `Boolean` / Default: `true`\n\n\u003e Load `default-css-variables.css` / `default-css-variables.layer.css` — contains all CSS variables generated from the default theme\n\n#### `global`: `Boolean` / Default: `true`\n\n\u003e Load `global.css` / `global.layer.css` — global classes used in Mantine components\n\n#### `allDependencies`: `Boolean` / Default: `true`\n\n\u003e Some components like Select do not have any styles on their own – they are built on top of other components. So we cannot automate that without lurking Mantine sources. If you are not sure which components are used in a particular component, you can import all styles for components that are reused in other components. https://mantine.dev/styles/css-files-list/#components-dependencies\n\n## Problem\n\nIn Mantine, you have to manually import CSS for components you use.\n\nReason: there is two versions of CSS for each component: `.css` and `.layer.css`, so you have to decide what to use. Official answer is [“Mantine is not a building tool”](https://github.com/orgs/mantinedev/discussions/6894#discussioncomment-12089815), so I decided to fill this gap.\n\nYou can just import all Mantine CSS containing every CSS for every Mantine component:\n\n```ts\nimport '@mantine/core/styles.css'\n```\n\nbut you will import CSS for components you don't use in your project.\n\n`styles.css` is 226KB\n\n## Solution\n\nVite plugin looking for imports from `@mantine/core` for each your source `.ts` or `.tsx` file, adding CSS imports based on hypothesis that every component has CSS named after it.\n\nExample: if you add this to `MyComponent.tsx`:\n\n```ts\nimport { Accordion } from '@mantine/core'\n```\n\nSo we want to add this to `MyComponent.tsx`:\n\n```ts\nimport '@mantine/core/styles/Accordion.css'\n```\n\nIn `@mantine/core/styles` directory, we have all CSS files we want:\n\n```\nAccordion.css\nAccordion.layer.css\nActionIcon.css\nActionIcon.layer.css\n… and so on\n```\n\nSo I automated this.\n\n(Don't worry about import duplication: any bundler will deduplicate them across bundle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrawl%2Funplugin-mantine-autoload-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrawl%2Funplugin-mantine-autoload-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrawl%2Funplugin-mantine-autoload-css/lists"}