@gluhar/theme
Gluhar Theme package. Sets up Tailwind CSS v4, ships shared tokens (theme.css) and fonts, and hands the CSS breakpoints to useResponsive().
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>/@applyonly 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'refalseon 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-*: initialresets) and writes them toappConfig.gluhar.breakpoints. Never hardcode breakpoint numbers in JS. - Name breakpoints for what they do (
cols,nav) rather than remappingmd/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