astro
Version:
Astro is a modern site builder with web best practices, performance, and DX front-of-mind.
71 lines (70 loc) • 1.91 kB
JavaScript
export const DEFAULTS = {
weights: ["400"],
styles: ["normal", "italic"],
subsets: ["latin"],
// Technically serif is the browser default but most websites these days use sans-serif
fallbacks: ["sans-serif"],
optimizedFallbacks: true,
formats: ["woff2"]
};
export const VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/internal";
export const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
export const RUNTIME_VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/runtime";
export const RESOLVED_RUNTIME_VIRTUAL_MODULE_ID = "\0" + RUNTIME_VIRTUAL_MODULE_ID;
export const RUNTIME_FONT_FILE_URL_RESOLVER_VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/runtime/font-file-url-resolver";
export const RESOLVED_RUNTIME_FONT_FILE_URL_RESOLVER_VIRTUAL_MODULE_ID = "\0" + RUNTIME_FONT_FILE_URL_RESOLVER_VIRTUAL_MODULE_ID;
export const ASSETS_DIR = "fonts";
export const CACHE_DIR = "./fonts/";
export const FONT_TYPES = [
"woff2",
"woff",
"otf",
"ttf",
"eot"
];
export const FONT_FORMATS = [
{
type: "woff2",
format: "woff2"
},
{
type: "woff",
format: "woff"
},
{
type: "otf",
format: "opentype"
},
{
type: "ttf",
format: "truetype"
},
{
type: "eot",
format: "embedded-opentype"
}
];
export const GENERIC_FALLBACK_NAMES = [
"serif",
"sans-serif",
"monospace",
"cursive",
"fantasy",
"system-ui",
"ui-serif",
"ui-sans-serif",
"ui-monospace",
"ui-rounded",
"emoji",
"math",
"fangsong"
];
export const FONTS_TYPES_FILE = "fonts.d.ts";
/**
* Variable name used in the font-file-url-resolver virtual module to hold
* the ephemeral font HTTP server address. The incremental build plugin
* strips the variable declaration (which contains an OS-assigned port that
* changes every build) from the module source before hashing so that the
* dependency hash is deterministic across builds.
*/
export const FONTS_SERVER_ADDRESS_PLACEHOLDER = "__ASTRO_FONTS_SERVER_ADDRESS__";