@gluhar/theme

中文文档
6.4.1发布于 2026/11/16MITTypeScriptES Module近 30 天下载 3034

Gluhar Theme package. Sets up Tailwind CSS v4, ships shared tokens (theme.css) and fonts, and feeds the CSS breakpoints to useResponsive.

原始使用文档
文档目录4 节
  1. Setup
  2. Conventions
  3. What theme.css provides
  4. Contribution

@gluhar/theme

npm version npm downloads License Nuxt

Gluhar Theme package. Sets up Tailwind CSS v4, ships shared tokens (theme.css) and fonts, and hands the CSS breakpoints to useResponsive().

✨  Release Notes

Setup

Installed by @gluhar/app. It registers @tailwindcss/vite; there is no JS Tailwind config. tailwindcss is a peer dependency and must be installed in the project.

assets/styles/main.css (option gluhar.theme.css) is added to nuxt.options.css unless you list it yourself, e.g. to order it after font CSS:

@import "tailwindcss";
@import "@gluhar/theme/theme.css";

@theme {
  --breakpoint-tablet: 48.0625rem; /* overrides gluhar's 768px */
  --breakpoint-nav: 75.0625rem; /* project-named, also usable as up("nav") */
  --color-brand: #0181d2;
}

Fluid type is a separate, optional plugin: @gluhar/fluid.

Conventions

  • Styling lives in the template as utilities, including all responsive styling (tablet:, desktop:, project-named variants). <style> / @apply only for what utilities can't reach (third-party markup, scrollbars, @layer base).
  • CSS owns layout; JS owns behaviour. Never switch layout on useResponsive() flags — they're false on the server by design.
  • Declare breakpoints once, as --breakpoint-* in the main stylesheet or a local file it @imports. The module reads them at build time (rem at 16px, --breakpoint-*: initial resets) and writes them to appConfig.gluhar.breakpoints. Never hardcode breakpoint numbers in JS.
  • Name breakpoints for what they do (cols, nav) rather than remapping md/lg.

What theme.css provides

primary-light|base|dark, secondary-base, accent-base, white-base colours; tablet (768) / desktop (1200) / wide (2000) breakpoints; tracking-tightest, leading-tighter|tightest, ease-in-out-expo; h-screen-s|l|d, flex-0-auto; class-based dark:; Lenis base CSS; and the @source that scans @gluhar/app's components.

Fonts: @import "@gluhar/theme/fonts/object-sans"; or css: ["@gluhar/theme/fonts/object-sans"].

Contribution

Local development
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

版本与发布记录

@gluhar/theme 共发布 36 个版本,首次发布于 2025/01/22;过去 12 个月发布了 22 个版本。

版本发布日期距今
6.4.1latest2026/11/16今天
6.4.02026/11/161 天前
6.3.22026/11/161 天前
6.3.12026/11/151 天前
6.3.02026/11/151 天前
6.2.02026/11/151 天前

其他发布通道:next → 6.0.0-next.12。

关于 @gluhar/theme 的常见问题

@gluhar/theme 是什么?

Gluhar Theme package. Sets up Tailwind CSS v4, ships shared tokens (theme.css) and fonts, and feeds the CSS breakpoints to useResponsive.

如何安装 @gluhar/theme?

在项目目录运行 npm install @gluhar/theme,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:nuxt(^4.6.2)、tailwindcss(^4.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gluhar/theme 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gluhar/theme 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gluhar/theme 可以商用吗?

@gluhar/theme 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gluhar/theme 的下载量有多少?

根据 npm 官方下载统计,@gluhar/theme 在 2026/10/17 – 2026/11/15 这 30 天内被下载 3,034 次,日均约 101 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gluhar/theme 还在维护吗?

最新版本 6.4.1 发布于 2026/11/16(今天);至今共发布 36 个版本,其中过去 12 个月发布了 22 个;首次发布于 2025/01/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。