Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #342 from JLHwung/add-postcss-font-family-system-ui
Browse files Browse the repository at this point in the history
Add postcss-font-family-system-ui
  • Loading branch information
MoOx committed Mar 16, 2017
2 parents 8c72990 + cf5a472 commit fe6d852
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/content/features.md
Expand Up @@ -483,6 +483,20 @@ div {
|
[Plugin documentation](https://github.com/dmarchena/postcss-color-hsl)

## `system-ui` font-family

Allows you to use `system-ui` generic font-family. The current transformation provides a practical font-family list as fallback.

```css
body {
font-family: system-ui;
}
```

[Specification](https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui)
|
[Plugin documentation](https://github.com/JLHwung/postcss-font-family-system-ui)

## @todo

Any omissions of the CSS specifications (even in draft) that are subject to be
Expand Down
6 changes: 6 additions & 0 deletions docs/content/index.md
Expand Up @@ -151,6 +151,12 @@ title: cssnext - Use tomorrow’s CSS syntax, today.
(functional-notation)
</small>
</li>
<li class="r-Grid-cell r-minS--1of2">
<a href="/features/#system-ui-font-family"><code>system-ui</code> font-family</a>
<small class="cssnext-FeaturesList-small">
(font-family fallback)
</small>
</li>
</ul>
<small
class="cssnext-FeaturesList-small"
Expand Down
5 changes: 5 additions & 0 deletions docs/content/playground.html
Expand Up @@ -85,6 +85,11 @@
/* attribute case insensitive */
[frame=hsides i] {
border-style: solid none;
}

/* system-ui font-family */
body {
font-family: system-ui;
}

</textarea>
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -41,6 +41,7 @@
"postcss-custom-media": "^5.0.0",
"postcss-custom-properties": "^5.0.0",
"postcss-custom-selectors": "^3.0.0",
"postcss-font-family-system-ui": "^1.0.1",
"postcss-font-variant": "^2.0.0",
"postcss-initial": "^1.3.1",
"postcss-media-minmax": "^2.1.0",
Expand Down
27 changes: 27 additions & 0 deletions src/__tests__/fixtures/features/font-family-system-ui.css
@@ -0,0 +1,27 @@
selector {
font-family: system-ui, sans-serif;
}

selector {
font-family: system-ui, Helvetica Neue, sans-serif;
}

selector {
font-family: sans-serif;
}

selector {
font: italic bold 12px/30px system-ui, sans-serif;
}

selector {
font: italic bold 12px/30px system-ui, Helvetica Neue, sans-serif;
}

selector {
font: italic 12px sans-serif;
}

selector {
font-weight: 700;
}
27 changes: 27 additions & 0 deletions src/__tests__/fixtures/features/font-family-system-ui.expected.css
@@ -0,0 +1,27 @@
selector {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}

selector {
font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica Neue, sans-serif;
}

selector {
font-family: sans-serif;
}

selector {
font: italic bold 12px/30px system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}

selector {
font: italic bold 12px/30px system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica Neue, sans-serif;
}

selector {
font: italic 12px sans-serif;
}

selector {
font-weight: 700;
}
3 changes: 3 additions & 0 deletions src/features.js
Expand Up @@ -51,6 +51,9 @@ export default {
// https://npmjs.com/package/postcss-color-function
colorFunction: (options) => require("postcss-color-function")(options),

// https://npmjs.com/package/postcss-font-family-system-ui
fontFamilySystemUi: (options) => require("postcss-font-family-system-ui")(options),

// https://npmjs.com/package/postcss-font-variant
fontVariant: (options) => require("postcss-font-variant")(options),

Expand Down

0 comments on commit fe6d852

Please sign in to comment.