Browse Source

Morden: migrate to use font-family mixin

Andrés 5 years ago
parent
commit
2bdedfcca8
4 changed files with 64 additions and 13 deletions
  1. 52 13
      morden/sass/_config-child-theme-deep.scss
  2. 4 0
      morden/style-editor.css
  3. 4 0
      morden/style-rtl.css
  4. 4 0
      morden/style.css

+ 52 - 13
morden/sass/_config-child-theme-deep.scss

@@ -20,10 +20,19 @@ $config-global: (
 	"font": (
 	"font": (
 		/* Font Family */
 		/* Font Family */
 		"family": (
 		"family": (
-			"primary": "\"Noto Sans\"\, -apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
-			"secondary": "\"Noto Sans\"\, -apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+			"primary": (
+				"fallback": "\"Noto Sans\"\, -apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+				"css-var": '--font-headings',
+			),
+			"secondary": (
+				"fallback": "\"Noto Sans\"\, -apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+				"css-var": '--font-base',
+			),
 			"code": "monospace, monospace",
 			"code": "monospace, monospace",
-			"ui": "\"Noto Sans\"\, -apple-system\, BlinkMacSystemFont\, \"Segoe UI\"\, \"Roboto\"\, \"Oxygen\"\, \"Ubuntu\"\, \"Cantarell\"\, \"Fira Sans\"\, \"Droid Sans\"\, \"Helvetica Neue\"\, sans-serif",
+			"ui": (
+				"fallback": "\"Noto Sans\"\, -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", "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"),
 			"line-height": map-deep-get($config-global, "font", "line-height", "md"),
 			"size": map-deep-get($config-global, "font", "size", "md"),
 			"size": map-deep-get($config-global, "font", "size", "md"),
 			"weight": bold,
 			"weight": bold,
@@ -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", "base"),
 		"size": map-deep-get($config-global, "font", "size", "base"),
 		"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", "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: (
 $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", "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"),
 				"size": map-deep-get($config-global, "font", "size", "xxl"),
 				"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", "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", "xs"),
 				"size": map-deep-get($config-global, "font", "size", "xs"),
 			),
 			),
 		),
 		),
@@ -323,7 +356,10 @@ $config-header: (
 		),
 		),
 		// Fonts
 		// Fonts
 		"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"),
+			),
 			"family-css-variable": '--font-base',
 			"family-css-variable": '--font-base',
 			"size": map-deep-get($config-global, "font", "size", "base"),
 			"size": map-deep-get($config-global, "font", "size", "base"),
 			"weight": bold,
 			"weight": bold,
@@ -354,7 +390,10 @@ $config-footer: (
 	),
 	),
 	// 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", "xs"),
 		"size": map-deep-get($config-global, "font", "size", "xs"),
 		"line-height": map-deep-get($config-global, "font", "line-height", "xs"),
 		"line-height": map-deep-get($config-global, "font", "line-height", "xs"),
 	),
 	),

+ 4 - 0
morden/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
  */
  */

+ 4 - 0
morden/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
  */
  */

+ 4 - 0
morden/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
  */
  */