Skip to content

Add unocss-preset-mgplus: UnoCSS preset for the mgplus mini CSS library#1

Draft
medevod with Copilot wants to merge 2 commits into
mainfrom
copilot/add-mgpluss-preset-for-uno-css
Draft

Add unocss-preset-mgplus: UnoCSS preset for the mgplus mini CSS library#1
medevod with Copilot wants to merge 2 commits into
mainfrom
copilot/add-mgpluss-preset-for-uno-css

Conversation

Copilot AI commented Apr 6, 2026

Copy link
Copy Markdown

Introduces unocss-preset-mgplus, a UnoCSS preset that brings mgplus styles into UnoCSS workflows — eliminating the need for a separate CSS import while enabling tree-shaking on utility classes.

Package setup

  • package.json / tsconfig.json / tsup.config.ts — TypeScript library project with dual ESM+CJS output and type declarations; unocss as peer dependency
  • test/preset.test.ts — 44 vitest tests covering all rule categories and preflight options

Preset implementation (src/)

  • index.ts — exports presetMgplus(options?) accepting components, utilities, and darkMode flags
  • types.tsPresetMgplusOptions and ComponentName union type
  • preflights.ts — injects CSS custom properties (:root { --mg-* }) and full component styles (button, badge, alert, nav, modal, grid, tabs, check, toggle, dropdown, loader, progress, group, icon, timeline, dark mode) as UnoCSS preflights; component inclusion is configurable
  • rules.ts — tree-shakeable UnoCSS rules for all utility classes: spacing (mg-pad*, mg-marg*), sizing (mg-w*, mg-h*, mg-min-*, mg-max-*), display, overflow, visibility, border/radius, positioning, z-index, text, and color utilities (mg-{color}, mg-bg-{color}, mg-border-{color})

Usage

// uno.config.ts
import { defineConfig } from 'unocss'
import { presetMgplus } from 'unocss-preset-mgplus'

export default defineConfig({
  presets: [
    presetMgplus({
      components: ['button', 'badge', 'grid'], // or true for all
      utilities: true,
      darkMode: true,
    }),
  ],
})

Component styles with pseudo-classes/nested selectors are injected via preflights (no tree-shaking); utility classes are defined as UnoCSS rules and are tree-shaken at build time.

Copilot AI changed the title [WIP] Add new mgpluss preset for Uno CSS Add unocss-preset-mgplus: UnoCSS preset for the mgplus mini CSS library Apr 6, 2026
Copilot AI requested a review from medevod April 6, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants