-
Notifications
You must be signed in to change notification settings - Fork 887
feat(website): no global docusaurus styles #8482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tkajtoch
merged 6 commits into
elastic:main
from
tkajtoch:feat/no-global-docusaurus-styles
Mar 24, 2025
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
46db830
feat: switch to mostly infima-less docusaurus styles
tkajtoch b754967
style: replace infima hero styles
tkajtoch cf6666f
style: replace infima ToC styles
tkajtoch eb4dc45
style: replace infima footer styles
tkajtoch 68fe775
fix: remove unused `configureWebpack` arguments left after local testing
tkajtoch a61fee1
docs(EuiCommentList): update styles and highlighted area values to wo…
tkajtoch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # `@elastic/eui-docusaurus-preset` | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "name": "@elastic/eui-docusaurus-preset", | ||
| "description": "EUI preset for Docusaurus", | ||
| "main": "lib/index.js", | ||
| "types": "lib/index.d.ts", | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "start": "tsc --watch" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/elastic/eui.git", | ||
| "directory": "packages/docusaurus-preset" | ||
| }, | ||
| "devDependencies": { | ||
| "@docusaurus/types": "^3.7.0", | ||
| "typescript": "~5.5.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "react": "^18.0.0 || ^19.0.0", | ||
| "react-dom": "^18.0.0 || ^19.0.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| import type { | ||
| LoadContext, | ||
| PluginConfig, | ||
| PluginModule, | ||
| PluginOptions, | ||
| Preset, | ||
| } from '@docusaurus/types'; | ||
| import { Options } from './options'; | ||
|
|
||
| /** | ||
| * Docusaurus plugin to ignore any Infima stylesheet imports. | ||
| * This is needed so that Infima doesn't pollute global CSS scope | ||
| * and affect how EUI components are rendered | ||
| */ | ||
| const ignoreInfimaPlugin: PluginModule = () => ({ | ||
| name: 'ignore-infima-plugin', | ||
| configureWebpack(config: any, isServer: boolean, utils: any) { | ||
| return { | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /node_modules\/infima/, | ||
| use: 'null-loader', | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
| }, | ||
| }); | ||
|
|
||
| const makePluginConfig = ( | ||
| source: string, | ||
| options?: PluginOptions | ||
| ): string | [string, PluginOptions] => { | ||
| if (!options) { | ||
| return require.resolve(source); | ||
| } | ||
|
|
||
| return [require.resolve(source), options]; | ||
| }; | ||
|
|
||
| export default function preset( | ||
| context: LoadContext, | ||
| options: Options = {} | ||
| ): Preset { | ||
| const isProd = process.env.NODE_ENV === 'production'; | ||
|
|
||
| const themes: PluginConfig[] = [ | ||
| // EUI theme is based on the classic docusaurus theme | ||
| require.resolve('@docusaurus/theme-classic'), | ||
|
|
||
| require.resolve('@elastic/eui-docusaurus-theme'), | ||
| ]; | ||
|
|
||
| const plugins: PluginConfig[] = [ | ||
| ignoreInfimaPlugin, | ||
| makePluginConfig('@docusaurus/plugin-content-docs', options.docs), | ||
| makePluginConfig('@docusaurus/plugin-content-pages', options.pages), | ||
| makePluginConfig('@docusaurus/plugin-svgr', options.svgr), | ||
| ]; | ||
|
|
||
| if (options.blog !== false) { | ||
| plugins.push( | ||
| makePluginConfig('@docusaurus/plugin-content-blog', options.blog) | ||
| ); | ||
| } | ||
|
|
||
| if (isProd) { | ||
| plugins.push( | ||
| makePluginConfig('@docusaurus/plugin-sitemap', options.sitemap) | ||
| ); | ||
| } | ||
|
|
||
| if (options.googleAnalytics) { | ||
| plugins.push( | ||
| makePluginConfig( | ||
| '@docusaurus/plugin-google-analytics', | ||
| options.googleAnalytics | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| if (options.googleTagManager) { | ||
| plugins.push( | ||
| makePluginConfig( | ||
| '@docusaurus/plugin-google-tag-manager', | ||
| options.googleTagManager | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| if (options.gtag) { | ||
| plugins.push( | ||
| makePluginConfig('@docusaurus/plugin-google-gtag', options.gtag) | ||
| ); | ||
| } | ||
|
|
||
| return { themes, plugins }; | ||
| } | ||
|
|
||
| export type { Options }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| // Based on https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-preset-classic/src/options.ts | ||
|
|
||
| import type { ThemeConfig as BaseThemeConfig } from '@docusaurus/types'; | ||
| import type { UserThemeConfig as ClassicThemeConfig } from '@docusaurus/theme-common'; | ||
|
|
||
| import type { Options as DocsPluginOptions } from '@docusaurus/plugin-content-docs'; | ||
| import type { Options as BlogPluginOptions } from '@docusaurus/plugin-content-blog'; | ||
| import type { Options as PagesPluginOptions } from '@docusaurus/plugin-content-pages'; | ||
| import type { Options as SitemapPluginOptions } from '@docusaurus/plugin-sitemap'; | ||
| import type { Options as SVGRPluginOptions } from '@docusaurus/plugin-svgr'; | ||
| import type { Options as ThemeOptions } from '@docusaurus/theme-classic'; | ||
| import type { Options as GAPluginOptions } from '@docusaurus/plugin-google-analytics'; | ||
| import type { Options as GtagPluginOptions } from '@docusaurus/plugin-google-gtag'; | ||
| import type { Options as GTMPluginOptions } from '@docusaurus/plugin-google-tag-manager'; | ||
|
|
||
| export type Options = { | ||
| /** | ||
| * Options for `@docusaurus/plugin-content-docs`. | ||
| */ | ||
| docs?: DocsPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-content-pages`. | ||
| */ | ||
| pages?: PagesPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-svgr`. | ||
| */ | ||
| svgr?: SVGRPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-sitemap`. | ||
| * Enabled in production builds | ||
| */ | ||
| sitemap?: SitemapPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/theme-classic`. | ||
| */ | ||
| theme?: ThemeOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-content-blog`. | ||
| * Use `false` to disable. | ||
| */ | ||
| blog?: false | BlogPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-google-analytics`. Only enabled when the | ||
| * key is present. | ||
| */ | ||
| googleAnalytics?: GAPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-google-gtag`. Only enabled when the key | ||
| * is present. | ||
| */ | ||
| gtag?: GtagPluginOptions; | ||
|
|
||
| /** | ||
| * Options for `@docusaurus/plugin-google-tag-manager`. Only enabled when | ||
| * the key is present. | ||
| */ | ||
| googleTagManager?: GTMPluginOptions; | ||
| }; | ||
|
|
||
| export type ThemeConfig = BaseThemeConfig & ClassicThemeConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "compilerOptions": { | ||
| "outDir": "lib", | ||
| /* Emit */ | ||
| "target": "ES2020", | ||
| "lib": ["ESNext", "DOM"], | ||
| "declaration": true, | ||
| // These two options will be selectively overridden in each project. | ||
| // Utility libraries will have source maps on, but plugins will not. | ||
| "declarationMap": false, | ||
| "sourceMap": false, | ||
| "jsx": "react-jsx", | ||
| "jsxImportSource": "@emotion/react", | ||
| "importHelpers": true, | ||
| "noEmitHelpers": true, | ||
|
|
||
| /* Strict Type-Checking Options */ | ||
| "allowUnreachableCode": false, | ||
| // Too hard to turn on | ||
| "exactOptionalPropertyTypes": false, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "noImplicitOverride": true, | ||
| "noImplicitReturns": true, | ||
| // `process.env` is usually accessed as property | ||
| "noPropertyAccessFromIndexSignature": false, | ||
| "noUncheckedIndexedAccess": true, | ||
| /* strict family */ | ||
| "strict": true, | ||
| "alwaysStrict": true, | ||
| "noImplicitAny": true, | ||
| "noImplicitThis": true, | ||
| "strictBindCallApply": true, | ||
| "strictFunctionTypes": true, | ||
| "strictNullChecks": true, | ||
| "strictPropertyInitialization": true, | ||
| "useUnknownInCatchVariables": true, | ||
| /* Handled by ESLint */ | ||
| "noUnusedLocals": false, | ||
| "noUnusedParameters": false, | ||
| "importsNotUsedAsValues": "remove", | ||
|
|
||
| /* Module Resolution */ | ||
| "moduleResolution": "Node", | ||
| "resolveJsonModule": true, | ||
| "allowSyntheticDefaultImports": true, | ||
| "esModuleInterop": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "isolatedModules": true, | ||
| "allowJs": true, | ||
| "skipLibCheck": true | ||
| }, | ||
| "include": ["src"], | ||
| "exclude": [ | ||
| "node_modules" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking:
We're not using these values, can we remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Removed in 68fe775