跳至主要內容

後處理 CSS

此專案設定會透過 Autoprefixer 自動縮小您的 CSS 並為其新增供應商前綴,讓您不必為此煩惱。

對於新的 CSS 功能,例如 所有 屬性斷行 屬性自訂屬性媒體查詢範圍,會自動載入相關 Polyfill 以支援較舊的瀏覽器。

您可以調整 package.json 中的 browserslist 金鑰以根據 Browserslist 規範,自訂目標支援的瀏覽器。

例如,這個

.App {
display: flex;
flex-direction: row;
align-items: center;
}

會變成這個

.App {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}

如果您需要禁用基於某種原因的 autoprefixing,請參閱此區段

CSS Grid Layout 前綴預設為停用,但它不會移除手動前綴。如果您想使用 CSS Grid 前綴,請先了解其限制

如要啟用 CSS Grid 前綴,請將 /* autoprefixer grid: autoplace */ 新增至 CSS 檔案的最上方。