Détail du package

postcss-font-variant

postcss24.7mMIT5.0.0

PostCSS plugin to transform W3C font-variant properties to more compatible CSS (font-feature-settings)

css, postcss, postcss-plugin, font

readme

PostCSS Font-Variant PostCSS Logo

CSS Status Build Status

PostCSS Font-Variant lets you use font-variant in CSS, following the CSS Fonts specification.

Installation

$ npm install postcss-font-variant

Usage

// dependencies
var postcss = require("postcss")
var fontVariant = require("postcss-font-variant")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css using postcss-font-variant
var out = postcss()
  .use(fontVariant())
  .process(css)
  .css

Using this input.css:

h2 {
  font-variant-caps: small-caps;
}

table {
  font-variant-numeric: lining-nums;
}

you will get:

h2 {
  font-feature-settings: "smcp";
  font-variant-caps: small-caps;
}

table {
  font-feature-settings: "lnum";
  font-variant-numeric: lining-nums;
}

Checkout tests for more examples.


Contributing

Work on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.

$ git clone https://github.com/postcss/postcss-font-variant.git
$ git checkout -b patch-1
$ npm install
$ npm test

Changelog

License

changelog

5.0.0 - 2021-01-12

  • Changed: use PostCSS 7 API
  • Updated: Node support to 10.0.0 (major)

4.0.1 - 2020-10-28

  • Fixed: Incorrect conversion of small-caps (#15)

4.0.0 - 2018-09-17

  • Changed: use PostCSS 7 API

3.0.0 - 2017-05-11

  • Changed: use PostCSS 6 API

2.0.1 - 2016-07-08

  • Fixed: existing font-feature-settings being duplicated. (#8 - @ChaosExAnima)

2.0.0 - 2015-09-08

  • Added: compatibility with postcss v5.x
  • Removed: compatiblity with postcss v4.x

1.2.0 - 2015-08-13

  • Added: compatibility with postcss v4.1.x (#5)

1.1.0 - 2015-01-29

  • Fixed: Properly handle font-variant-position:normal (#3)
  • Added: support font-kerning (#2)

1.0.2 - 2015-01-27

  • Fixed: Re–use existing font-feature-settings declarations to avoid creating multiples that override themselves (#1)

1.0.1 - 2014-11-11

  • Fixed: wrong space char that breaks on some environnements

1.0.0 - 2014-10-09

✨ First release based on rework-font-variant v1.0.1