postcss-colormin 7.0.6 → 7.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-colormin",
3
- "version": "7.0.6",
3
+ "version": "7.0.8",
4
4
  "description": "Minify colors in your CSS files with PostCSS.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "repository": "cssnano/cssnano",
29
29
  "dependencies": {
30
- "browserslist": "^4.28.1",
30
+ "@colordx/core": "^5.0.3",
31
+ "browserslist": "^4.28.2",
31
32
  "caniuse-api": "^3.0.0",
32
- "colord": "^2.9.3",
33
33
  "postcss-value-parser": "^4.2.0"
34
34
  },
35
35
  "bugs": {
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/caniuse-api": "^3.0.6",
43
- "postcss": "^8.5.6"
43
+ "postcss": "^8.5.8"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "postcss": "^8.4.32"
package/src/index.js CHANGED
@@ -108,6 +108,7 @@ function addPluginDefaults(options, browsers) {
108
108
  * @property {boolean} [hsl]
109
109
  * @property {boolean} [name]
110
110
  * @property {boolean} [transparent]
111
+ * @property {boolean} [transformCustomProperties] Whether to minify colors inside custom property values (default: true)
111
112
  */
112
113
 
113
114
  /**
@@ -150,6 +151,10 @@ function pluginCreator(config = {}) {
150
151
  return;
151
152
  }
152
153
 
154
+ if (config.transformCustomProperties === false && decl.prop.startsWith('--')) {
155
+ return;
156
+ }
157
+
153
158
  const value = decl.value;
154
159
 
155
160
  if (!value) {
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
- const { colord, extend } = require('colord');
3
- const namesPlugin = require('colord/plugins/names');
4
- const minifierPlugin = require('colord/plugins/minify');
2
+ const { colordx: colord, extend } = require('@colordx/core');
3
+ const hwbPlugin = require('@colordx/core/plugins/hwb');
4
+ const namesPlugin = require('@colordx/core/plugins/names');
5
+ const minifierPlugin = require('@colordx/core/plugins/minify');
5
6
 
6
- extend(/** @type {any[]} */ ([namesPlugin, minifierPlugin]));
7
+ extend(/** @type {any[]} */ ([hwbPlugin, namesPlugin, minifierPlugin]));
7
8
 
8
9
  /**
9
10
  * Performs color value minification
10
11
  *
11
12
  * @param {string} input - CSS value
12
- * @param {import('./index.js').MinifyColorOptions} options - object with colord.minify() options
13
+ * @param {import('./index.js').MinifyColorOptions} options - object with colordx.minify() options
13
14
  * @return {string}
14
15
  */
15
16
  module.exports = function minifyColor(input, options = {}) {
package/types/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export = pluginCreator;
7
7
  * @property {boolean} [hsl]
8
8
  * @property {boolean} [name]
9
9
  * @property {boolean} [transparent]
10
+ * @property {boolean} [transformCustomProperties] Whether to minify colors inside custom property values (default: true)
10
11
  */
11
12
  /**
12
13
  * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
@@ -30,6 +31,10 @@ type MinifyColorOptions = {
30
31
  hsl?: boolean | undefined;
31
32
  name?: boolean | undefined;
32
33
  transparent?: boolean | undefined;
34
+ /**
35
+ * Whether to minify colors inside custom property values (default: true)
36
+ */
37
+ transformCustomProperties?: boolean | undefined;
33
38
  };
34
39
  type AutoprefixerOptions = {
35
40
  overrideBrowserslist?: string | string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAsGA;;;;;;;;GAQG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,wCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAsDnC;;;;;;;;;;;;;2BA9DY;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;eACpD,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAsGA;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,wCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CA0DnC;;;;;;;;;;;;;;;;;2BAlEY;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;eACpD,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"minifyColor.d.ts","sourceRoot":"","sources":["../src/minifyColor.js"],"names":[],"mappings":"AAciB,iCAJN,MAAM,YACN,OAAO,YAAY,EAAE,kBAAkB,GACtC,MAAM,CAejB"}
1
+ {"version":3,"file":"minifyColor.d.ts","sourceRoot":"","sources":["../src/minifyColor.js"],"names":[],"mappings":"AAeiB,iCAJN,MAAM,YACN,OAAO,YAAY,EAAE,kBAAkB,GACtC,MAAM,CAejB"}