فهرست منبع

Shawburn: migrate to use font-family mixin

Andrés 5 سال پیش
والد
کامیت
16114f7b36
5فایلهای تغییر یافته به همراه74 افزوده شده و 25 حذف شده
  1. 52 14
      shawburn/sass/_config-child-theme-deep.scss
  2. 1 2
      shawburn/sass/_extra-child-theme.scss
  3. 7 3
      shawburn/style-editor.css
  4. 7 3
      shawburn/style-rtl.css
  5. 7 3
      shawburn/style.css

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

@@ -20,10 +20,19 @@ $config-global: (
 	"font": (
 		/* Font Family */
 		"family": (
-			"primary": "\"PT Serif\"\, Times, sans-serif",
-			"secondary": "\"PT Sans\"\, Arial\, sans-serif",
+			"primary": (
+				"fallback": "\"PT Serif\"\, Times, sans-serif",
+				"css-var": '--font-headings',
+			),
+			"secondary": (
+				"fallback": "\"PT Sans\"\, 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", "base"),
 			"size": map-deep-get($config-global, "font", "size", "base"),
 			"weight": 400,
@@ -169,7 +181,10 @@ $config-button: (
 	),
 	// 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"),
 		"weight": 700,
 		"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"),
+		),
 	),
 );
 
@@ -297,7 +324,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", "xxl"),
 				"weight": 400,
 			),
@@ -306,7 +336,10 @@ $config-header: (
 		"description": (
 			// 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"),
 			),
 		),
@@ -321,8 +354,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", "sm"),
 			"weight": 700,
 			"line-height": 1,
@@ -352,7 +387,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"),
 	),

+ 1 - 2
shawburn/sass/_extra-child-theme.scss

@@ -332,8 +332,7 @@ hr.wp-block-separator.is-style-wide,
 .a8c-posts-list .a8c-posts-list-item__featured span {
 	background: #{map-deep-get($config-global, "color", "background", "light")};
 	color: #{map-deep-get($config-global, "color", "foreground", "light")};
-	font-family: #{map-deep-get($config-global, "font", "family", "ui")}; // For browsers without CSS custom properties support.
-	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;
 }
 

+ 7 - 3
shawburn/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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", 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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", 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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", Arial, sans-serif);
 	font-size: 1.44em;
 	letter-spacing: normal;
 	line-height: 1.125;

+ 7 - 3
shawburn/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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", 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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;
@@ -2375,7 +2379,7 @@ table th,
 .site-description {
 	color: currentColor;
 	font-family: "PT Serif", Times, sans-serif;
-	font-family: var(--font-base, "PT Serif", Times, sans-serif);
+	font-family: var(--font-headings, "PT Serif", Times, sans-serif);
 }
 
 body:not(.fse-enabled) .site-title {

+ 7 - 3
shawburn/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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", 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: "PT Sans", Arial, sans-serif;
-	font-family: var(--font-headings, "PT Sans", Arial, sans-serif);
+	font-family: var(--font-base, "PT Sans", Arial, sans-serif);
 	font-size: 1.2rem;
 	letter-spacing: normal;
 	line-height: 1.125;
@@ -2392,7 +2396,7 @@ table th,
 .site-description {
 	color: currentColor;
 	font-family: "PT Serif", Times, sans-serif;
-	font-family: var(--font-base, "PT Serif", Times, sans-serif);
+	font-family: var(--font-headings, "PT Serif", Times, sans-serif);
 }
 
 body:not(.fse-enabled) .site-title {