PostCSS Font Width Property runs in all Node environments, with special instructions for:
Add PostCSS Font Width Property to your project:
npm install postcss @csstools/postcss-font-width-property --save-devUse it as a PostCSS plugin:
// commonjs
const postcss = require('postcss');
const postcssFontWidthProperty = require('@csstools/postcss-font-width-property');
postcss([
postcssFontWidthProperty(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);// esm
import postcss from 'postcss';
import postcssFontWidthProperty from '@csstools/postcss-font-width-property';
postcss([
postcssFontWidthProperty(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);Add PostCSS CLI to your project:
npm install postcss-cli @csstools/postcss-font-width-property --save-devUse PostCSS Font Width Property in your postcss.config.js configuration file:
const postcssFontWidthProperty = require('@csstools/postcss-font-width-property');
module.exports = {
plugins: [
postcssFontWidthProperty(/* pluginOptions */)
]
}If your framework/CLI supports postcss-load-config.
npm install @csstools/postcss-font-width-property --save-devpackage.json:
{
"postcss": {
"plugins": {
"@csstools/postcss-font-width-property": {}
}
}
}.postcssrc.json:
{
"plugins": {
"@csstools/postcss-font-width-property": {}
}
}See the README of postcss-load-config for more usage options.
Webpack version 5
Add PostCSS Loader to your project:
npm install postcss-loader @csstools/postcss-font-width-property --save-devUse PostCSS Font Width Property in your Webpack configuration:
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: { importLoaders: 1 },
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
// Other plugins,
[
"@csstools/postcss-font-width-property",
{
// Options
},
],
],
},
},
},
],
},
],
},
};Read the instructions on how to customize the PostCSS configuration in Next.js
npm install @csstools/postcss-font-width-property --save-devUse PostCSS Font Width Property in your postcss.config.json file:
{
"plugins": [
"@csstools/postcss-font-width-property"
]
}{
"plugins": [
[
"@csstools/postcss-font-width-property",
{
// Optionally add plugin options
}
]
]
}Add Gulp PostCSS to your project:
npm install gulp-postcss @csstools/postcss-font-width-property --save-devUse PostCSS Font Width Property in your Gulpfile:
const postcss = require('gulp-postcss');
const postcssFontWidthProperty = require('@csstools/postcss-font-width-property');
gulp.task('css', function () {
var plugins = [
postcssFontWidthProperty(/* pluginOptions */)
];
return gulp.src('./src/*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest('.'));
});Add Grunt PostCSS to your project:
npm install grunt-postcss @csstools/postcss-font-width-property --save-devUse PostCSS Font Width Property in your Gruntfile:
const postcssFontWidthProperty = require('@csstools/postcss-font-width-property');
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
postcss: {
options: {
processors: [
postcssFontWidthProperty(/* pluginOptions */)
]
},
dist: {
src: '*.css'
}
}
});