@davidwells/config-postcss 0.1.0 → 0.1.1

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": "@davidwells/config-postcss",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Reusable postcss config",
5
5
  "author": "DavidWells",
6
6
  "license": "MIT",
@@ -27,6 +27,7 @@
27
27
  "cssnano": "^4.1.10",
28
28
  "dedent": "^0.7.0",
29
29
  "globby": "^11.0.1",
30
+ "is-color": "^1.0.2",
30
31
  "is-css-unit": "^1.0.0",
31
32
  "kleur": "^4.1.3",
32
33
  "pleeease-filters": "^4.0.0",
@@ -56,6 +57,8 @@
56
57
  "postcss-simple-vars": "5.0.2",
57
58
  "postcss-sort-media-queries": "^2.3.15",
58
59
  "postcss-sorting": "^6.0.0",
60
+ "rgb-hex": "^3.0.0",
61
+ "safe-chalk": "^1.0.0",
59
62
  "validate-color": "^2.1.1"
60
63
  },
61
64
  "devDependencies": {
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ const webpackLoaderOptionUtil = require('./webpackLoaderOptionUtil')
6
6
  const mixins = require('./_mixins')
7
7
  const variables = require('./_variables')
8
8
  const functions = require('./_functions')
9
+ const printColors = require('./printColors')
9
10
 
10
11
  module.exports = {
11
12
  getPostCSSConfig,
@@ -14,5 +15,6 @@ module.exports = {
14
15
  webpackLoaderOptionUtil,
15
16
  mixins,
16
17
  variables,
17
- functions
18
+ functions,
19
+ printColors,
18
20
  }
@@ -0,0 +1,22 @@
1
+ const chalk = require('safe-chalk')
2
+ const isColor = require('is-color')
3
+ const { isHex } = require('is-color')
4
+ const rgbHex = require('rgb-hex')
5
+
6
+ // Hot reload webpack files for PostCSS
7
+ module.exports = function printColors(variables = {}) {
8
+ if (!variables) {
9
+ return
10
+ }
11
+ console.log('CSS variables:')
12
+ console.log(variables)
13
+ console.log('Colors:')
14
+ Object.keys(variables).forEach((key) => {
15
+ const val = variables[key]
16
+ if (val && typeof val === 'string' && isColor(val)) {
17
+ const color = (isHex(val)) ? val : `#${rgbHex(val)}`
18
+ console.log(`${chalk.hex(color).bold('████████████')} $${key} - ${val}`)
19
+ }
20
+ })
21
+ console.log('👆 CSS variables usable via ${nameOfThing} in css files') // eslint-disable-line
22
+ }
package/CHANGELOG.md DELETED
@@ -1,40 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.0.17](https://github.com/DavidWells/components/compare/@davidwells/config-postcss@0.0.16...@davidwells/config-postcss@0.0.17) (2021-01-13)
7
-
8
- **Note:** Version bump only for package @davidwells/config-postcss
9
-
10
-
11
-
12
-
13
-
14
- ## [0.0.16](https://github.com/DavidWells/components/compare/@davidwells/config-postcss@0.0.15...@davidwells/config-postcss@0.0.16) (2021-01-08)
15
-
16
- **Note:** Version bump only for package @davidwells/config-postcss
17
-
18
-
19
-
20
-
21
-
22
- ## [0.0.15](https://github.com/DavidWells/components/compare/@davidwells/config-postcss@0.0.14...@davidwells/config-postcss@0.0.15) (2021-01-08)
23
-
24
- **Note:** Version bump only for package @davidwells/config-postcss
25
-
26
-
27
-
28
-
29
-
30
- ## [0.0.14](https://github.com/DavidWells/components/compare/@davidwells/config-postcss@0.0.13...@davidwells/config-postcss@0.0.14) (2021-01-08)
31
-
32
- **Note:** Version bump only for package @davidwells/config-postcss
33
-
34
-
35
-
36
-
37
-
38
- ## 0.0.13 (2021-01-08)
39
-
40
- **Note:** Version bump only for package @davidwells/config-postcss