瀏覽代碼

Rockfield: migrate to use font-family mixin

Andrés 5 年之前
父節點
當前提交
1e0a297bcc

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

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

+ 4 - 8
rockfield/sass/_extra-child-theme.scss

@@ -248,8 +248,7 @@ a {
 
 
 	.meta-nav {
 	.meta-nav {
 		color: #{map-deep-get($config-global, "color", "foreground", "light")};
 		color: #{map-deep-get($config-global, "color", "foreground", "light")};
-		font-family: #{map-deep-get($config-global, "font", "family", "ui")};
-		font-family: var( --font-headings, #{map-deep-get($config-global, "font", "family", "ui")} );
+		@include font-family( map-deep-get($config-global, "font", "family", "ui") );
 		font-weight: bold;
 		font-weight: bold;
 		text-transform: uppercase;
 		text-transform: uppercase;
 	}
 	}
@@ -287,8 +286,7 @@ a {
 .a8c-posts-list .a8c-posts-list-item__featured span {
 .a8c-posts-list .a8c-posts-list-item__featured span {
 	background: #{map-deep-get($config-global, "color", "secondary", "default")};
 	background: #{map-deep-get($config-global, "color", "secondary", "default")};
 	color: #{map-deep-get($config-global, "color", "background", "default")};
 	color: #{map-deep-get($config-global, "color", "background", "default")};
-	font-family: #{map-deep-get($config-global, "font", "family", "ui")};
-	font-family: var( --font-base, #{map-deep-get($config-global, "font", "family", "ui")} );
+	@include font-family( map-deep-get($config-global, "font", "family", "ui") );
 	text-transform: uppercase;
 	text-transform: uppercase;
 }
 }
 
 
@@ -427,8 +425,7 @@ table,
 }
 }
 
 
 .comment-meta .comment-metadata {
 .comment-meta .comment-metadata {
-	font-family: #{map-deep-get($config-global, "font", "family", "ui")};
-	font-family: var( --font-base, #{map-deep-get($config-global, "font", "family", "ui")} );
+	@include font-family( map-deep-get($config-global, "font", "family", "ui") );
 	font-size: #{map-deep-get($config-global, "font", "size", "sm")};
 	font-size: #{map-deep-get($config-global, "font", "size", "sm")};
 	font-weight: bold;
 	font-weight: bold;
 	text-transform: uppercase;
 	text-transform: uppercase;
@@ -510,8 +507,7 @@ table,
   .widget-title,
   .widget-title,
   .widgettitle {
   .widgettitle {
     font-size: #{map-deep-get($config-global, "font", "size", "base")};
     font-size: #{map-deep-get($config-global, "font", "size", "base")};
-    font-family: #{map-deep-get($config-global, "font", "family", "ui")}; // For browsers without CSS custom properties support.
-    font-family: var( --font-headings, #{map-deep-get($config-global, "font", "family", "ui")} );
+    @include font-family( map-deep-get($config-global, "font", "family", "ui") );
     margin-bottom: #{0.5 * map-deep-get($config-global, "spacing", "vertical")};
     margin-bottom: #{0.5 * map-deep-get($config-global, "spacing", "vertical")};
 
 
     &:empty {
     &:empty {

+ 4 - 0
rockfield/style-editor.css

@@ -115,6 +115,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  * - 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
  * Child Theme Name
  */
  */

+ 10 - 6
rockfield/style-rtl.css

@@ -136,6 +136,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  * - 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 Deep
  * Child Theme Deep
  */
  */
@@ -1637,7 +1641,7 @@ img {
 ul,
 ul,
 ol {
 ol {
 	font-family: Lora, Baskerville, Georgia, Times, serif;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
-	font-family: var(--font-base, Lora, Baskerville, Georgia, Times, serif);
+	font-family: var(--font-headings, Lora, Baskerville, Georgia, Times, serif);
 	margin: 0;
 	margin: 0;
 	padding-right: 32px;
 	padding-right: 32px;
 }
 }
@@ -2355,7 +2359,7 @@ table th,
 .site-title {
 .site-title {
 	color: white;
 	color: white;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	letter-spacing: normal;
 	letter-spacing: normal;
 	line-height: 1;
 	line-height: 1;
 }
 }
@@ -2376,7 +2380,7 @@ table th,
 .site-description {
 .site-description {
 	color: currentColor;
 	color: currentColor;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
-	font-family: var(--font-base, Lora, Baskerville, Georgia, Times, serif);
+	font-family: var(--font-headings, Lora, Baskerville, Georgia, Times, serif);
 }
 }
 
 
 body:not(.fse-enabled) .site-title {
 body:not(.fse-enabled) .site-title {
@@ -2650,7 +2654,7 @@ body:not(.fse-enabled) .main-navigation a {
 .site-info {
 .site-info {
 	color: #757575;
 	color: #757575;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	font-size: 0.83333rem;
 	font-size: 0.83333rem;
 }
 }
 
 
@@ -3847,7 +3851,7 @@ p:not(.site-title) a:hover {
 .post-navigation .meta-nav {
 .post-navigation .meta-nav {
 	color: #757575;
 	color: #757575;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	font-weight: bold;
 	font-weight: bold;
 	text-transform: uppercase;
 	text-transform: uppercase;
 }
 }
@@ -4086,7 +4090,7 @@ table th,
 .widget-area .widgettitle {
 .widget-area .widgettitle {
 	font-size: 1rem;
 	font-size: 1rem;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	margin-bottom: 16px;
 	margin-bottom: 16px;
 }
 }
 
 

+ 10 - 6
rockfield/style.css

@@ -136,6 +136,10 @@ $grid-configuration: map-extend($grid-configuration-default, $grid-configuration
  * Crop Text Boundry
  * Crop Text Boundry
  * - Sets a fixed-width on content within alignwide and alignfull blocks
  * - 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 Deep
  * Child Theme Deep
  */
  */
@@ -1637,7 +1641,7 @@ img {
 ul,
 ul,
 ol {
 ol {
 	font-family: Lora, Baskerville, Georgia, Times, serif;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
-	font-family: var(--font-base, Lora, Baskerville, Georgia, Times, serif);
+	font-family: var(--font-headings, Lora, Baskerville, Georgia, Times, serif);
 	margin: 0;
 	margin: 0;
 	padding-left: 32px;
 	padding-left: 32px;
 }
 }
@@ -2372,7 +2376,7 @@ table th,
 .site-title {
 .site-title {
 	color: white;
 	color: white;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	letter-spacing: normal;
 	letter-spacing: normal;
 	line-height: 1;
 	line-height: 1;
 }
 }
@@ -2393,7 +2397,7 @@ table th,
 .site-description {
 .site-description {
 	color: currentColor;
 	color: currentColor;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
 	font-family: Lora, Baskerville, Georgia, Times, serif;
-	font-family: var(--font-base, Lora, Baskerville, Georgia, Times, serif);
+	font-family: var(--font-headings, Lora, Baskerville, Georgia, Times, serif);
 }
 }
 
 
 body:not(.fse-enabled) .site-title {
 body:not(.fse-enabled) .site-title {
@@ -2667,7 +2671,7 @@ body:not(.fse-enabled) .main-navigation a {
 .site-info {
 .site-info {
 	color: #757575;
 	color: #757575;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	font-size: 0.83333rem;
 	font-size: 0.83333rem;
 }
 }
 
 
@@ -3876,7 +3880,7 @@ p:not(.site-title) a:hover {
 .post-navigation .meta-nav {
 .post-navigation .meta-nav {
 	color: #757575;
 	color: #757575;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	font-weight: bold;
 	font-weight: bold;
 	text-transform: uppercase;
 	text-transform: uppercase;
 }
 }
@@ -4115,7 +4119,7 @@ table th,
 .widget-area .widgettitle {
 .widget-area .widgettitle {
 	font-size: 1rem;
 	font-size: 1rem;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
 	font-family: Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-	font-family: var(--font-headings, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
+	font-family: var(--font-base, Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);
 	margin-bottom: 16px;
 	margin-bottom: 16px;
 }
 }