This PR extends the build pipeline of the www service to support locale-prefixed static builds (EN/RU) with build-time SSG output injection, while also refactoring UI typography to a tokenized Tailwind v4 @theme-driven approach. Changes: - Add build-time SSG plugin to @ermnvldmr/rsbuild-config and wire multi-locale builds (/en/, /ru/) into services/www. - Introduce new @ermnvldmr/i18n package (locale constants, path helpers, keysets, pluralization) and apply it to www navigation/text. - Refactor ui typography to a shared getTypographyClassNames utility + Tailwind token definitions, with stl/cn updated for correct Tailwind-merge behavior.
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import { defineServiceConfig, discoverEntries, mergeConfig } from '@ermnvldmr/rsbuild-config/dev';
|
|
import { THEME_INIT_SCRIPT, THEME_INIT_STYLES } from '@ermnvldmr/ui/dev';
|
|
import { localeRsbuildConfig } from '@ermnvldmr/i18n/dev';
|
|
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
|
|
import { pluginMdx } from '@rsbuild/plugin-mdx';
|
|
import remarkFrontmatter from 'remark-frontmatter';
|
|
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
|
|
|
|
const fontBase = 'static/font';
|
|
|
|
export default defineServiceConfig(
|
|
mergeConfig(localeRsbuildConfig(), {
|
|
tools: {
|
|
rspack: {
|
|
plugins: [
|
|
process.env.RSDOCTOR === 'true' &&
|
|
new RsdoctorRspackPlugin({
|
|
disableClientServer: true,
|
|
output: { reportDir: './rsdoctor', mode: 'brief' },
|
|
}),
|
|
].filter(Boolean),
|
|
},
|
|
},
|
|
plugins: [
|
|
pluginMdx({
|
|
mdxLoaderOptions: {
|
|
remarkPlugins: [remarkFrontmatter, [remarkMdxFrontmatter, { name: 'frontmatter' }]],
|
|
},
|
|
}),
|
|
],
|
|
source: {
|
|
entry: discoverEntries(import.meta.dirname, './src/app/**/*.tsx'),
|
|
},
|
|
html: {
|
|
tags: [
|
|
{ tag: 'script', children: THEME_INIT_SCRIPT, head: true },
|
|
{ tag: 'style', children: THEME_INIT_STYLES, head: true },
|
|
{
|
|
tag: 'link',
|
|
attrs: {
|
|
rel: 'preload',
|
|
as: 'font',
|
|
type: 'font/woff2',
|
|
href: `${fontBase}/lato-400.woff2`,
|
|
crossorigin: true,
|
|
},
|
|
},
|
|
{
|
|
tag: 'link',
|
|
attrs: {
|
|
rel: 'preload',
|
|
as: 'font',
|
|
type: 'font/woff2',
|
|
href: `${fontBase}/lato-700.woff2`,
|
|
crossorigin: true,
|
|
},
|
|
},
|
|
{
|
|
tag: 'link',
|
|
attrs: {
|
|
rel: 'preload',
|
|
as: 'font',
|
|
type: 'font/woff2',
|
|
href: `${fontBase}/eb-garamond-var.woff2`,
|
|
crossorigin: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})
|
|
);
|