Socket
Socket
Sign inDemoInstall

postcss-minify-font-values

Package Overview
Dependencies
5
Maintainers
8
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.3 to 6.1.0

4

package.json
{
"name": "postcss-minify-font-values",
"version": "6.0.3",
"version": "6.1.0",
"description": "Minify font declarations with PostCSS",

@@ -34,3 +34,3 @@ "main": "src/index.js",

"devDependencies": {
"postcss": "^8.4.35"
"postcss": "^8.4.37"
},

@@ -37,0 +37,0 @@ "peerDependencies": {

@@ -55,3 +55,3 @@ # postcss-minify-font-values [![Build Status][ci-img]][ci]

Type: `boolean`
Type: `boolean` | `(prop: string) => '' | 'font' | 'font-family' | 'font-weight'`
Default: `true`

@@ -63,2 +63,4 @@

Pass a function to determine whether a css variable is one of `font`, `font-family`, and `font-weight` to determine whether the variable needs to remove quotes.
## Usage

@@ -65,0 +67,0 @@

@@ -25,6 +25,11 @@ 'use strict';

let lowerCasedProp = prop.toLowerCase();
let variableType = '';
if (lowerCasedProp === 'font-weight' && !hasVariableFunction(value)) {
if (typeof opts.removeQuotes === 'function') {
variableType = opts.removeQuotes(prop);
opts.removeQuotes = true;
}
if ((lowerCasedProp === 'font-weight' || variableType === 'font-weight') && !hasVariableFunction(value)) {
return minifyWeight(value);
} else if (lowerCasedProp === 'font-family' && !hasVariableFunction(value)) {
} else if ((lowerCasedProp === 'font-family' || variableType === 'font-family') && !hasVariableFunction(value)) {
const tree = valueParser(value);

@@ -35,3 +40,3 @@

return tree.toString();
} else if (lowerCasedProp === 'font') {
} else if (lowerCasedProp === 'font' || variableType === 'font') {
return minifyFont(value, opts);

@@ -43,3 +48,3 @@ }

/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean}} Options */
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean | ((prop: string) => '' | 'font' | 'font-family' | 'font-weight')}} Options */

@@ -46,0 +51,0 @@ /**

export = pluginCreator;
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean}} Options */
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean | ((prop: string) => '' | 'font' | 'font-family' | 'font-weight')}} Options */
/**

@@ -13,7 +13,7 @@ * @type {import('postcss').PluginCreator<Options>}

type Options = {
removeAfterKeyword?: boolean;
removeDuplicates?: boolean;
removeQuotes?: boolean;
removeAfterKeyword?: boolean | undefined;
removeDuplicates?: boolean | undefined;
removeQuotes?: boolean | ((prop: string) => '' | 'font' | 'font-family' | 'font-weight') | undefined;
};
declare var postcss: true;
//# sourceMappingURL=index.d.ts.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc