Skip to content

Commit

Permalink
inline stylesheets: update config schema and types
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Apr 13, 2023
1 parent f0e5a74 commit 16314db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,24 +1013,24 @@ export interface AstroUserConfig {
assets?: boolean;
/**
* @docs
* @name experimental.stylesheets
* @type {'external' | 'auto' | 'inline'}
* @name experimental.inlineStylesheets
* @type {'always' | 'auto' | 'never'}
* @default `external`
* @description
* Control whether the styles from astro modules get included in external stylsheets or inlined into <style> tags
* Control whether the styles imported or authored in astro modules are sent to the browser in a seprate css file or inlined into <style> tags
*
* "external" : always put styles in external stylsheets
* "auto" : stylesheets smaller than `ViteConfig.build.assetsInlineLimit` (default: 4kb) are inlined
* "inline" : always inline styles
* "always" : all styles necessary are inlined into <style> tags
* "auto" : stylesheets smaller than `ViteConfig.build.assetsInlineLimit` (default: 4kb) are inlined
* "never" : all styles necessary are sent in external stylsheets
*
* ```js
* {
* experimental: {
* assets: "auto",
* inlineStylesheets: "auto",
* },
* }
*/
stylesheets?: 'external' | 'auto' | 'inline';
inlineStylesheets?: 'always' | 'auto' | 'never';
};

// Legacy options to be removed
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
legacy: {},
experimental: {
assets: false,
stylesheets: 'external',
inlineStylesheets: 'never',
},
};

Expand Down Expand Up @@ -181,10 +181,10 @@ export const AstroConfigSchema = z.object({
experimental: z
.object({
assets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.assets),
stylesheets: z
.enum(['external', 'auto', 'inline'])
inlineStylesheets: z
.enum(['always', 'auto', 'never'])
.optional()
.default(ASTRO_CONFIG_DEFAULTS.experimental.stylesheets),
.default(ASTRO_CONFIG_DEFAULTS.experimental.inlineStylesheets),
})
.optional()
.default({}),
Expand Down

0 comments on commit 16314db

Please sign in to comment.