hebrew-tailwind-preset
Configure Tailwind CSS v4 for Hebrew RTL applications with dir variants, Hebrew font stacks, and logical property utilities. Use when user asks about Tailwind RTL setup, Hebrew Tailwind config, "Tailwind ivrit" (Hebrew Tailwind), RTL utility classes, logical properties in Tailwind, ms-/me- utilities, or Tailwind Hebrew font configuration. Covers Tailwind v4 dir variants, Hebrew font stack presets, logical property utilities (ms-/me-/ps-/pe- instead of ml-/mr-/pl-/pr-), RTL-first component patterns, and Hebrew typography tokens. Do NOT use for general CSS RTL patterns (use hebrew-rtl-best-practices) or full design systems (use israeli-ui-design-system instead).
skills-il · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add skills-il/localization --skill hebrew-tailwind-preset技能说明
name: hebrew-tailwind-preset description: Configure Tailwind CSS v4 for Hebrew RTL applications with dir variants, Hebrew font stacks, and logical property utilities. Use when user asks about Tailwind RTL setup, Hebrew Tailwind config, "Tailwind ivrit" (Hebrew Tailwind), RTL utility classes, logical properties in Tailwind, ms-/me- utilities, or Tailwind Hebrew font configuration. Covers Tailwind v4 dir variants, Hebrew font stack presets, logical property utilities (ms-/me-/ps-/pe- instead of ml-/mr-/pl-/pr-), RTL-first component patterns, and Hebrew typography tokens. Do NOT use for general CSS RTL patterns (use hebrew-rtl-best-practices) or full design systems (use israeli-ui-design-system instead). license: MIT
Hebrew Tailwind Preset
Tailwind CSS v4 recommended (current release v4.3, May 2026); v3.1+ is compatible for dir variants. Works with React, Vue, Angular, Next.js, and Nuxt. No network required.
Instructions
Step 1: Install and Configure Tailwind v4 for RTL
See references/rtl-config.md for complete configuration reference.
Install the Tailwind v4 build plugin first. Tailwind v4 dropped the automatic tailwind.config.js loading, so @import "tailwindcss" alone will not build until a build plugin is wired. Pick the one matching your toolchain:
# Vite (recommended): install the first-party Vite plugin
npm install tailwindcss @tailwindcss/vite
// vite.config.js -- add the plugin
import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [tailwindcss()],
});
# PostCSS-based toolchains (Next.js, Webpack, etc.)
npm install tailwindcss @tailwindcss/postcss postcss
// postcss.config.mjs
export default {
plugins: { '@tailwindcss/postcss': {} },
};
In v4 the @tailwindcss/postcss plugin handles @import inlining and vendor prefixing, so postcss-import and autoprefixer are no longer needed.
Then load Hebrew fonts with font-display: swap (via a Google Fonts <link> or an @font-face rule) to avoid a Flash of Invisible Text while the Hebrew font file loads. See Step 2 for the snippet.
Tailwind v4 (CSS-first configuration):
/* app.css -- imported by your build entry */
@import "tailwindcss";
@theme {
/* Hebrew font stacks */
--font-hebrew: 'Heebo', 'Assistant', 'Noto Sans Hebrew', sans-serif;
--font-hebrew-serif: 'Frank Ruhl Libre', 'David Libre', serif;
--font-mono: 'Fira Code', 'Source Code Pro', monospace;
/* Hebrew-optimized type scale */
--text-xs: 0.8125rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
--text-3xl: 1.875rem;
--text-4xl: 2.25rem;
/* Hebrew line heights (taller than Latin defaults) */
--leading-tight: 1.4;
--leading-normal: 1.7;
--leading-relaxed: 1.9;
}
Tailwind v3 (JavaScript configuration):
// tailwind.config.js
module.exports = {
content: ['./src/**/*.{html,js,jsx,tsx}'],
theme: {
extend: {
fontFamily: {
hebrew: ['Heebo', 'Assistant', 'Noto Sans Hebrew', 'sans-serif'],
'hebrew-serif': ['Frank Ruhl Libre', 'David Libre', 'serif'],
},
lineHeight: {
'hebrew': '1.7',
'hebrew-tight': '1.4',
'hebrew-relaxed': '1.9',
},
},
},
plugins: [],
};
Load the Hebrew fonts with font-display: swap. Either add a Google Fonts <link> in your HTML head:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;700&family=Assistant:wght@400;600&display=swap" rel="stylesheet">
Or self-host with an @font-face rule inside the same CSS file as your @theme block:
@font-face {
font-family: 'Heebo';
src: url('/fonts/heebo-variable.woff2') format('woff2');
font-weight: 400 700;
font-display: swap;
}
The &display=swap query param (link) and the font-display: swap descriptor (@font-face) both make the browser render fallback text immediately instead of hiding text until the Hebrew font loads.
Next.js: wire next/font through @theme inline. When you self-host with next/font (recommended for Next.js: no external request, no layout shift), the font is exposed as a CSS variable, and @theme cannot reference a runtime variable directly. Use @theme inline so the variable resolves at the use site:
/* app.css */
@import "tailwindcss";
@theme inline {
--font-hebrew: var(--font-heebo); /* --font-heebo comes from next/font */
}
// layout.tsx
import { Heebo } from 'next/font/google';
const heebo = Heebo({ subsets: ['hebrew', 'latin'], variable: '--font-heebo' });
// <html lang="he" dir="rtl" className={heebo.variable}> ... </html>
Plain @theme { --font-hebrew: var(--font-heebo); } (without inline) breaks, because Tailwind tries to resolve the variable at build time when it does not yet exist.
Step 2: Use Logical Property Utilities
Tailwind v4's native logical utilities and rtl:/ltr: variants cover RTL on their own, so the old community tailwindcss-rtl plugin is no longer needed. Always prefer logical utilities over physical directional ones:
| Physical (avoid) | Logical (use) | RTL Behavior |
|---|---|---|
ml-4 | ms-4 | Right margin in RTL |
mr-4 | me-4 | Left margin in RTL |
pl-4 | ps-4 | Right padding in RTL |
pr-4 | pe-4 | Left padding in RTL |
left-0 | inset-s-0 | Right: 0 in RTL (v4.3+; start-0 is the deprecated alias) |
right-0 | inset-e-0 | Left: 0 in RTL (v4.3+; end-0 is the deprecated alias) |
border-l | border-s | Right border in RTL |
border-r | border-e | Left border in RTL |
rounded-l-lg | rounded-s-lg | Right rounded in RTL |
rounded-r-lg | rounded-e-lg | Left rounded in RTL |
text-left |