Skip to content

Commit f399a33

Browse files
committed
Update fontsource integration according with the documentation
1 parent 9827547 commit f399a33

File tree

3 files changed

+43
-8
lines changed

3 files changed

+43
-8
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
},
1717
"license": "GPL-2.0",
1818
"dependencies": {
19+
"@fontsource-utils/scss": "^0.2.2",
1920
"@fontsource/poppins": "^5.0.5",
21+
"add": "^2.0.6",
2022
"lazysizes": "^5.3.2",
21-
"oneloop.js": "^5.2.1"
23+
"oneloop.js": "^5.2.1",
24+
"yarn": "^1.22.22"
2225
},
2326
"devDependencies": {
2427
"@wordpress/blocks": "^11.16.0",

src/scss/03-base/_fonts.scss

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*
77
* Examples :
88
*
9-
* 1 - Install the font by the command :
9+
* 1 - Install the font and the utilities by the command :
10+
* yarn add @fontsource-utils/scss
11+
*
1012
* // For Classic font
1113
* yarn add @fontsource/myFont
1214
*
@@ -15,20 +17,23 @@
1517
*
1618
* 2 - Declare font-face :
1719
* // For Classic font
18-
* @use "~@fontsource/myFont/scss/mixins" as MyFont;
19-
* @include MyFont.faces($weights: (400, 700));
20+
* @use "../../../node_modules/@fontsource-utils/scss/src/mixins" as fontsource;
21+
* @use "../../../node_modules/@fontsource/myFont/scss/mixins" as MyFont;
22+
* @include fontsource.faces($metadata: MyFont.$metadata, $weights: (400, 700));
2023
* ...
2124
*
2225
* // For Variable font
23-
* @use "~@fontsource-variable/myFont/scss/mixins" as MyFont;
24-
* @include MyFont.faces($axes: all);
26+
* @use "../../../node_modules/@fontsource-utils/scss/src/mixins" as fontsource;
27+
* @use "../../../node_modules/@fontsource-variable/myFont/scss/mixins" as MyFont;
28+
* @include fontsource.faces($metadata: MyFont.$metadata, $axes: wght);
2529
* ...
2630
*/
2731

32+
@use "../../../node_modules/@fontsource-utils/scss/src/mixins" as fontsource;
2833
@use "../../../node_modules/@fontsource/poppins/scss/mixins" as Poppins;
2934

30-
@include Poppins.faces($weights: (300, 400, 500, 700), $styles: normal);
31-
@include Poppins.faces($weights: (300, 400, 500, 700), $styles: italic);
35+
@include fontsource.faces($metadata: Poppins.$metadata, $weights: (300, 400, 500, 700), $styles: normal);
36+
@include fontsource.faces($metadata: Poppins.$metadata, $weights: (300, 400, 500, 700), $styles: italic);
3237

3338
// Fallbacks for DM Sans to improve cls
3439
// https://deploy-preview-15--upbeat-shirley-608546.netlify.app/perfect-ish-font-fallback/?font=Poppins

yarn.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,13 @@ __metadata:
628628
languageName: node
629629
linkType: hard
630630

631+
"@fontsource-utils/scss@npm:^0.2.2":
632+
version: 0.2.2
633+
resolution: "@fontsource-utils/scss@npm:0.2.2"
634+
checksum: 10/d4092b7564a82806d83e6f2d9a3b5e2b7ee187e52d57a24ae26fe2d074ab4aea205ed729ce2f2ffa3ecd4dfae1089e4003b7ae4e92162c0ac6fa1ff9ad5e0adf
635+
languageName: node
636+
linkType: hard
637+
631638
"@fontsource/poppins@npm:^5.0.5":
632639
version: 5.2.5
633640
resolution: "@fontsource/poppins@npm:5.2.5"
@@ -1892,6 +1899,13 @@ __metadata:
18921899
languageName: node
18931900
linkType: hard
18941901

1902+
"add@npm:^2.0.6":
1903+
version: 2.0.6
1904+
resolution: "add@npm:2.0.6"
1905+
checksum: 10/1d2c0780a660edfc161b7784a846865b28dcd8514cc6042c8e283298f379cd3b150412b67a12603a4ac885912f05759f3e2993c27219f85d1face316ffc0b175
1906+
languageName: node
1907+
linkType: hard
1908+
18951909
"agent-base@npm:^7.1.0, agent-base@npm:^7.1.2":
18961910
version: 7.1.3
18971911
resolution: "agent-base@npm:7.1.3"
@@ -2250,13 +2264,15 @@ __metadata:
22502264
version: 0.0.0-use.local
22512265
resolution: "beapi-frontend-framework@workspace:."
22522266
dependencies:
2267+
"@fontsource-utils/scss": "npm:^0.2.2"
22532268
"@fontsource/poppins": "npm:^5.0.5"
22542269
"@wordpress/blocks": "npm:^11.16.0"
22552270
"@wordpress/browserslist-config": "npm:^6.21.0"
22562271
"@wordpress/dependency-extraction-webpack-plugin": "npm:^4.0.0"
22572272
"@wordpress/dom-ready": "npm:^3.17.0"
22582273
"@wordpress/hooks": "npm:^3.17.0"
22592274
"@wordpress/stylelint-config": "npm:^21.0.0"
2275+
add: "npm:^2.0.6"
22602276
clean-webpack-plugin: "npm:^4.0.0-alpha.0"
22612277
concurrently: "npm:^8.2.2"
22622278
css-loader: "npm:^5.2.4"
@@ -2301,6 +2317,7 @@ __metadata:
23012317
webpack-manifest-plugin: "npm:5.0.0"
23022318
webpack-merge: "npm:^5.7.3"
23032319
webpackbar: "npm:^5.0.0-3"
2320+
yarn: "npm:^1.22.22"
23042321
languageName: unknown
23052322
linkType: soft
23062323

@@ -12161,6 +12178,16 @@ __metadata:
1216112178
languageName: node
1216212179
linkType: hard
1216312180

12181+
"yarn@npm:^1.22.22":
12182+
version: 1.22.22
12183+
resolution: "yarn@npm:1.22.22"
12184+
bin:
12185+
yarn: bin/yarn.js
12186+
yarnpkg: bin/yarn.js
12187+
checksum: 10/98d80230beaa81f186b2256dff5ef9dce2dd6073c94299209f8e562da9018cff4275c95c27c788aaa4a9c3c186ea8a9aee9a5b83570696a4c8a9d1fff2d4da3a
12188+
languageName: node
12189+
linkType: hard
12190+
1216412191
"yauzl@npm:^2.4.2":
1216512192
version: 2.10.0
1216612193
resolution: "yauzl@npm:2.10.0"

0 commit comments

Comments
 (0)