diff --git a/docs/content/features.md b/docs/content/features.md index 7444c67..a2c36dd 100644 --- a/docs/content/features.md +++ b/docs/content/features.md @@ -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 diff --git a/docs/content/index.md b/docs/content/index.md index eeb08aa..7841270 100644 --- a/docs/content/index.md +++ b/docs/content/index.md @@ -151,6 +151,12 @@ title: cssnext - Use tomorrow’s CSS syntax, today. (functional-notation) +
  • + system-ui font-family + + (font-family fallback) + +
  • diff --git a/package.json b/package.json index f400532..95a744a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/__tests__/fixtures/features/font-family-system-ui.css b/src/__tests__/fixtures/features/font-family-system-ui.css new file mode 100644 index 0000000..50d1085 --- /dev/null +++ b/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; +} diff --git a/src/__tests__/fixtures/features/font-family-system-ui.expected.css b/src/__tests__/fixtures/features/font-family-system-ui.expected.css new file mode 100644 index 0000000..26a6865 --- /dev/null +++ b/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; +} diff --git a/src/features.js b/src/features.js index 5c385c3..1974df2 100644 --- a/src/features.js +++ b/src/features.js @@ -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),