mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-30 18:24:35 +01:00
Refactored build process
This commit is contained in:
parent
9024de91f6
commit
6ac2da115d
@ -92,7 +92,7 @@ slightly different:
|
|||||||
[mkdocs_theme.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml
|
[mkdocs_theme.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml
|
||||||
[custom theme guide]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme
|
[custom theme guide]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme
|
||||||
|
|
||||||
???+ tip "Recommended: configuration validation and auto-complete"
|
???+ tip "Recommended: [configuration validation and auto-complete]"
|
||||||
|
|
||||||
In order to minimize friction and maximize productivity, Material for MkDocs
|
In order to minimize friction and maximize productivity, Material for MkDocs
|
||||||
provides its own [schema.json] for `mkdocs.yml`. If your editor supports
|
provides its own [schema.json] for `mkdocs.yml`. If your editor supports
|
||||||
@ -121,7 +121,7 @@ slightly different:
|
|||||||
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
|
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[configuration validation and auto-complete]: https://twitter.com/squidfunk/status/1487746003692400642
|
||||||
[schema.json]: schema.json
|
[schema.json]: schema.json
|
||||||
[vscode-yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
|
[vscode-yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
|
||||||
[settings.json]: https://code.visualstudio.com/docs/getstarted/settings
|
[settings.json]: https://code.visualstudio.com/docs/getstarted/settings
|
||||||
|
@ -7045,6 +7045,13 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"Zilla Slab Highlight"
|
"Zilla Slab Highlight"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "default",
|
||||||
|
"markdownDescription": "https://fonts.google.com/specimen/default",
|
||||||
|
"enum": [
|
||||||
|
"default"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -20,7 +20,6 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import fonts from "google-fonts-complete"
|
|
||||||
import { minify as minhtml } from "html-minifier"
|
import { minify as minhtml } from "html-minifier"
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
import {
|
import {
|
||||||
@ -290,49 +289,54 @@ const index$ = zip(icons$, emojis$)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Compute font schema */
|
|
||||||
const fonts$ = of(Object.keys(fonts))
|
|
||||||
.pipe(
|
|
||||||
map(items => ({
|
|
||||||
"$schema": "https://json-schema.org/draft-07/schema",
|
|
||||||
"title": "Google Fonts",
|
|
||||||
"markdownDescription": "https://fonts.google.com/",
|
|
||||||
"type": "string",
|
|
||||||
"oneOf": items.map(item => ({
|
|
||||||
"title": item,
|
|
||||||
"markdownDescription": `https://fonts.google.com/specimen/${
|
|
||||||
item.replace(/\s+/g, "+")
|
|
||||||
}`,
|
|
||||||
"enum": [
|
|
||||||
item
|
|
||||||
],
|
|
||||||
}))
|
|
||||||
})),
|
|
||||||
switchMap(data => write(
|
|
||||||
"docs/schema/assets/fonts.json",
|
|
||||||
JSON.stringify(data, undefined, 2)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
const icons2$ = icons$
|
|
||||||
.pipe(
|
|
||||||
map(icons => ({
|
|
||||||
"$schema": "https://json-schema.org/draft-07/schema",
|
|
||||||
"title": "Icon",
|
|
||||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#search",
|
|
||||||
"type": "string",
|
|
||||||
"enum": [...icons.values()].map(item => item.replace(".svg", ""))
|
|
||||||
})),
|
|
||||||
switchMap(data => write(
|
|
||||||
"docs/schema/assets/icons.json",
|
|
||||||
JSON.stringify(data, undefined, 2)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Build schema */
|
/* Build schema */
|
||||||
const schema$ = merge(fonts$, icons2$)
|
const schema$ = merge(
|
||||||
|
|
||||||
|
/* Compute fonts schema */
|
||||||
|
defer(() => import("google-fonts-complete"))
|
||||||
|
.pipe(
|
||||||
|
map(Object.keys),
|
||||||
|
map(fonts => ({
|
||||||
|
"$schema": "https://json-schema.org/draft-07/schema",
|
||||||
|
"title": "Google Fonts",
|
||||||
|
"markdownDescription": "https://fonts.google.com/",
|
||||||
|
"type": "string",
|
||||||
|
"oneOf": fonts.map(font => ({
|
||||||
|
"title": font,
|
||||||
|
"markdownDescription": `https://fonts.google.com/specimen/${
|
||||||
|
font.replace(/\s+/g, "+")
|
||||||
|
}`,
|
||||||
|
"enum": [
|
||||||
|
font
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
})),
|
||||||
|
switchMap(data => write(
|
||||||
|
"docs/schema/assets/fonts.json",
|
||||||
|
JSON.stringify(data, undefined, 2)
|
||||||
|
))
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Compute icons schema */
|
||||||
|
icons$
|
||||||
|
.pipe(
|
||||||
|
map(icons => [...icons.values()]),
|
||||||
|
map(icons => ({
|
||||||
|
"$schema": "https://json-schema.org/draft-07/schema",
|
||||||
|
"title": "Icon",
|
||||||
|
"markdownDescription": [
|
||||||
|
"https://squidfunk.github.io/mkdocs-material",
|
||||||
|
"reference/icons-emojis/#search"
|
||||||
|
].join("/"),
|
||||||
|
"type": "string",
|
||||||
|
"enum": icons.map(icon => icon.replace(".svg", ""))
|
||||||
|
})),
|
||||||
|
switchMap(data => write(
|
||||||
|
"docs/schema/assets/icons.json",
|
||||||
|
JSON.stringify(data, undefined, 2)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Program
|
* Program
|
||||||
|
Loading…
Reference in New Issue
Block a user