Skip to content

Commit ec127a6

Browse files
committed
added custom design-system-plex-fonts.scss file to generate @font-face definitions for the selected IBM Plex fonts we use
1 parent f62cf3e commit ec127a6

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

packages/components/rollup.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function addScssCompilationPlugins(options) {
2626

2727
const result = sass.compile(inputFileFullPath, {
2828
sourceMap: true,
29-
loadPaths: ['node_modules/@hashicorp/design-system-tokens/dist'],
29+
loadPaths: [
30+
'node_modules/@hashicorp/design-system-tokens/dist',
31+
'node_modules/@ibm',
32+
],
3033
});
3134

3235
// Emit the compiled CSS
@@ -98,6 +101,10 @@ const plugins = [
98101
inputFile: 'design-system-power-select-overrides.scss',
99102
outputFile: 'design-system-power-select-overrides.css',
100103
},
104+
{
105+
inputFile: 'design-system-plex-fonts.scss',
106+
outputFile: 'design-system-plex-fonts.css',
107+
},
101108
]),
102109

103110
// Ensure that standalone .hbs files are properly integrated as Javascript.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Copyright (c) HashiCorp, Inc.
3+
* SPDX-License-Identifier: MPL-2.0
4+
*/
5+
6+
//
7+
// IBM PLEX FONTS
8+
//
9+
10+
// We use only a few selected weights, per design specs
11+
/* stylelint-disable value-keyword-case */
12+
$selected-weights: (
13+
// ❌ 100
14+
thin: false,
15+
thinItalic: false,
16+
// ❌ 200
17+
extralight: false,
18+
extralightItalic: false,
19+
// ❌ 300
20+
light: false,
21+
lightItalic: false,
22+
// ✅ 400
23+
regular: true,
24+
italic: true,
25+
// ❌ 500
26+
medium: false,
27+
mediumItalic: false,
28+
// ❌ 450
29+
text: false,
30+
textItalic: false,
31+
// ✅ 600
32+
semibold: true,
33+
semiboldItalic: true,
34+
// ❌ 700
35+
bold: false,
36+
boldItalic: false
37+
);
38+
/* stylelint-enable value-keyword-case */
39+
40+
// Plex Sans (imported from `node_modules/@ibm/plex-sans`)
41+
//
42+
@use "plex-sans/scss/index.scss" as PlexSans with (
43+
$font-prefix: "/assets",
44+
$font-weights: $selected-weights
45+
);
46+
47+
// Plex Mono (imported from `node_modules/@ibm/plex-mono`)
48+
//
49+
@use "plex-mono/scss/index.scss" as PlexMono with (
50+
$font-prefix: "/assets",
51+
$font-weights: $selected-weights
52+
);
53+
54+
// Add the `@font-face` definitions
55+
// see: https://github.com/IBM/plex/tree/master/packages/plex-sans#font-weights
56+
//
57+
@include PlexSans.all();
58+
@include PlexMono.all();

0 commit comments

Comments
 (0)