-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Switch build.inlineStylesheets
default to auto
#8118
Changes from all commits
b86493e
7a8cf4e
a19a6d5
d5ce23d
b38eb59
b3de00c
a4643bd
b37af2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Astro is smarter about CSS! Small stylesheets are now inlined by default, and no longer incur the cost of additional requests to your server. Your visitors will have to wait less before they see your pages, especially those in remote locations or in a subway. | ||
|
||
This may not be news to you if you had opted-in via the `build.inlineStylesheets` configuration. Stabilized in Astro 2.6 and set to "auto" by default for Starlight, this configuration allows you to reduce the number of requests for stylesheets by inlining them into <style> tags. The new default is "auto", which selects assets smaller than 4kB and includes them in the initial response. | ||
|
||
To go back to the previous default behavior, change `build.inlineStylesheets` to "never". | ||
|
||
```ts | ||
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
build: { | ||
inlineStylesheets: 'never', | ||
}, | ||
}); | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -836,7 +836,7 @@ export interface AstroUserConfig { | |
* @docs | ||
* @name build.inlineStylesheets | ||
* @type {('always' | 'auto' | 'never')} | ||
* @default `never` | ||
* @default `auto` | ||
* @version 2.6.0 | ||
* @description | ||
* Control whether project styles are sent to the browser in a separate css file or inlined into `<style>` tags. Choose from the following options: | ||
|
@@ -847,7 +847,7 @@ export interface AstroUserConfig { | |
* ```js | ||
* { | ||
* build: { | ||
* inlineStylesheets: `auto`, | ||
* inlineStylesheets: `never`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads up that I also updated here, since we typically show a setting that would need to be set, and you wouldn't need to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saving me again! |
||
* }, | ||
* } | ||
* ``` | ||
|
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.
lol How can I not approve this?