瀏覽代碼

Stow: migrate to use font-family mixin

Andrés 5 年之前
父節點
當前提交
70063f7cbe

+ 52 - 14
stow/sass/_config-child-theme-deep.scss

@@ -20,10 +20,19 @@ $config-global: (
 	"font": (
 		/* Font Family */
 		"family": (
-			"primary": "\"Oswald\"\, sans-serif",
-			"secondary": "\"Source Sans Pro\"\, Arial\, sans-serif",
+			"primary": (
+				"fallback": "\"Oswald\"\, sans-serif",
+				"css-var": '--font-headings',
+			),
+			"secondary": (
+				"fallback": "\"Source Sans Pro\"\, Arial\, sans-serif",
+				"css-var": '--font-base',
+			),
 			"code": "\"Courier 10 Pitch\"\, Courier\, monospace",
-			"ui": "-apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+			"ui": (
+				"fallback": "-apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+				"css-var": '--font-base',
+			),
 		),
 		/* Font Size */
 		"size": (
@@ -140,7 +149,10 @@ $config-elements: (
 
 		// Fonts
 		"font": (
-			"family": map-deep-get($config-global, "font", "family", "secondary"),
+			"family": (
+				"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+				"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+			),
 			"line-height": map-deep-get($config-global, "font", "line-height", "md"),
 			"size": map-deep-get($config-global, "font", "size", "md"),
 			"weight": bold,
@@ -169,7 +181,10 @@ $config-button: (
 	),
 	// Fonts
 	"font": (
-		"family": map-deep-get($config-global, "font", "family", "ui"),
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "ui", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "ui", "css-var"),
+		),
 		"size": map-deep-get($config-global, "font", "size", "xs"),
 		"weight": 600,
 		"line-height": 1,
@@ -202,7 +217,10 @@ $config-heading: (
 	// Fonts & Typography
 	"font": (
 		// Family
-		"family": map-deep-get($config-global, "font", "family", "primary"),
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "primary", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "primary", "css-var"),
+		),
 		// Size
 		"size": (
 			"h6": map-deep-get($config-global, "font", "size", "sm"),
@@ -241,7 +259,10 @@ $config-heading: (
 $config-list: (
 	// Fonts
 	"font": (
-		"family": map-deep-get($config-global, "font", "family", "secondary"),
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+		),
 	),
 );
 
@@ -251,7 +272,10 @@ $config-list: (
 $config-pullquote: (
 	// Font
 	"font": (
-		"family": #{map-deep-get($config-global, "font", "family", "secondary")},
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+		),
 	),
 	// Border
 	"color": (
@@ -270,7 +294,10 @@ $config-pullquote: (
 $config-quote: (
 	// Font
 	"font": (
-		"family": #{map-deep-get($config-global, "font", "family", "secondary")},
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+		),
 	),
 );
 
@@ -298,7 +325,10 @@ $config-header: (
 		"title": (
 			// Fonts
 			"font": (
-				"family": map-deep-get($config-global, "font", "family", "primary"),
+				"family": (
+					"fallback": map-deep-get($config-global, "font", "family", "primary", "fallback"),
+					"css-var": map-deep-get($config-global, "font", "family", "primary", "css-var"),
+				),
 				"size": map-deep-get($config-global, "font", "size", "md"),
 				"weight": 300,
 				"line-height": 1.3333,
@@ -308,7 +338,10 @@ $config-header: (
 		"description": (
 			// Fonts
 			"font": (
-				"family": map-deep-get($config-global, "font", "family", "secondary"),
+				"family": (
+					"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+					"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+				),
 				"size": map-deep-get($config-global, "font", "size", "sm"),
 			),
 		),
@@ -323,8 +356,10 @@ $config-header: (
 		),
 		// Fonts
 		"font": (
-			"family": map-deep-get($config-global, "font", "family", "secondary"),
-			"family-css-variable": '--font-base',
+			"family": (
+				"fallback": map-deep-get($config-global, "font", "family", "secondary", "fallback"),
+				"css-var": map-deep-get($config-global, "font", "family", "secondary", "css-var"),
+			),
 			"size": map-deep-get($config-global, "font", "size", "md"),
 			"weight": 700,
 			"line-height": 1,
@@ -354,7 +389,10 @@ $config-footer: (
 	),
 	// Fonts
 	"font": (
-		"family": map-deep-get($config-global, "font", "family", "primary"),
+		"family": (
+			"fallback": map-deep-get($config-global, "font", "family", "primary", "fallback"),
+			"css-var": map-deep-get($config-global, "font", "family", "primary", "css-var"),
+		),
 		"size": map-deep-get($config-global, "font", "size", "sm"),
 		"line-height": map-deep-get($config-global, "font", "line-height", "sm"),
 	),

+ 3 - 6
stow/sass/_extra-child-theme.scss

@@ -265,8 +265,7 @@ a {
 	border: 1px solid #f2f2f2;
 	padding: #{map-deep-get($config-global, "spacing", "horizontal")};;
 	p {
-		font-family: #{map-deep-get($config-global, "font", "family", "secondary")}; // For browsers without CSS custom properties support.
-		font-family: var( --font-base, #{map-deep-get($config-global, "font", "family", "secondary")} );
+		@include font-family( map-deep-get($config-global, "font", "family", "secondary") );
 	}
 	cite {
 		color: #{map-deep-get($config-global, "color", "secondary", "default")};
@@ -303,8 +302,7 @@ a {
 			color: #{map-deep-get($config-button, "color", "text")};
 			cursor: pointer;
 			font-weight: #{map-deep-get($config-button, "font", "weight")};
-			font-family: #{map-deep-get($config-button, "font", "family")};
-			font-family: var( --font-base, #{map-deep-get($config-button, "font", "family")} );
+			@include font-family( map-deep-get($config-button, "font", "family") );
 			font-size: #{map-deep-get($config-button, "font", "size")};
 			background-color: #{map-deep-get($config-button, "color", "background")};
 			border-radius: #{map-deep-get($config-button, "border-radius")};
@@ -327,8 +325,7 @@ a {
  */
 .wp-block-latest-comments {
 	.wp-block-latest-comments__comment-meta {
-		font-family: #{map-deep-get($config-global, "font", "family", "secondary")}; // For browsers without CSS custom properties support.
-		font-family: var( --font-base, #{map-deep-get($config-global, "font", "family", "secondary")} );
+		@include font-family( map-deep-get($config-global, "font", "family", "secondary") );
 		.wp-block-latest-comments__comment-date {
 			font-size: #{map-deep-get($config-global, "font", "size", "xs")};
 		}

+ 3 - 6
stow/sass/style-child-theme-editor.scss

@@ -94,8 +94,7 @@ a {
 	 border: 1px solid #f2f2f2;
 	 padding: #{map-deep-get($config-global, "spacing", "horizontal")};;
 	 p {
-		font-family: #{map-deep-get($config-global, "font", "family", "secondary")};
-		font-family: var( --font-base, #{map-deep-get($config-global, "font", "family", "secondary")} );
+		@include font-family( map-deep-get($config-global, "font", "family", "secondary") );
 	 }
 	 .wp-block-quote__citation {
 		 color: #{map-deep-get($config-global, "color", "secondary", "default")};
@@ -113,8 +112,7 @@ a {
 			color: #{map-deep-get($config-button, "color", "text")};
 			cursor: pointer;
 			font-weight: #{map-deep-get($config-button, "font", "weight")};
-			font-family: #{map-deep-get($config-button, "font", "family")};
-			font-family: var( --font-base, #{map-deep-get($config-button, "font", "family")} );
+			@include font-family( map-deep-get($config-button, "font", "family") );
 			font-size: #{map-deep-get($config-button, "font", "size")};
 			background-color: #{map-deep-get($config-button, "color", "background")};
 			border-radius: #{map-deep-get($config-button, "border-radius")};
@@ -163,8 +161,7 @@ a {
 		color: #{map-deep-get($config-button, "color", "text")};
 		cursor: pointer;
 		font-weight: #{map-deep-get($config-button, "font", "weight")};
-		font-family: #{map-deep-get($config-button, "font", "family")};
-		font-family: var( --font-base, #{map-deep-get($config-button, "font", "family")} );
+		@include font-family( map-deep-get($config-button, "font", "family") );
 		font-size: #{map-deep-get($config-button, "font", "size")};
 		background-color: #{map-deep-get($config-button, "color", "background")};
 		border-radius: #{map-deep-get($config-button, "border-radius")};

+ 7 - 3
stow/style-editor.css

@@ -115,6 +115,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  */
+/**
+ * Add font-family using CSS variables.
+ * It also adds the proper fallback for browsers without support.
+ */
 /**
  * Child Theme Name
  */
@@ -578,7 +582,7 @@ p.has-background:not(.has-background-background-color) a {
 
 .wp-block-pullquote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2em;
 	letter-spacing: normal;
 	line-height: 1.125;
@@ -638,7 +642,7 @@ p.has-background:not(.has-background-background-color) a {
 
 .wp-block-quote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2em;
 	letter-spacing: normal;
 }
@@ -650,7 +654,7 @@ p.has-background:not(.has-background-background-color) a {
 
 .wp-block-quote.is-large p, .wp-block-quote.is-style-large p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.44em;
 	letter-spacing: normal;
 	line-height: 1.125;

+ 6 - 2
stow/style-rtl.css

@@ -136,6 +136,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  */
+/**
+ * Add font-family using CSS variables.
+ * It also adds the proper fallback for browsers without support.
+ */
 /**
  * Child Theme Name
  */
@@ -1800,7 +1804,7 @@ p.has-background {
 
 .wp-block-pullquote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;
@@ -1880,7 +1884,7 @@ p.has-background {
 
 .wp-block-quote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;

+ 6 - 2
stow/style.css

@@ -136,6 +136,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  */
+/**
+ * Add font-family using CSS variables.
+ * It also adds the proper fallback for browsers without support.
+ */
 /**
  * Child Theme Name
  */
@@ -1800,7 +1804,7 @@ p.has-background {
 
 .wp-block-pullquote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;
@@ -1880,7 +1884,7 @@ p.has-background {
 
 .wp-block-quote p {
 	font-family: "Source Sans Pro", Arial, sans-serif;
-	font-family: var(--font-headings, "Source Sans Pro", Arial, sans-serif);
+	font-family: var(--font-base, "Source Sans Pro", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;