Skip to content

Commit 59aa484

Browse files
committed
Upgrade to PostCSS 8
1 parent 18c41b3 commit 59aa484

File tree

3 files changed

+84
-65
lines changed

3 files changed

+84
-65
lines changed

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@
4444
"eslint-config-prettier": "^6.13.0",
4545
"eslint-plugin-prettier": "^3.1.4",
4646
"jest": "^26.5.2",
47+
"postcss": "^8.1.4",
4748
"prettier": "^2.1.2",
4849
"rimraf": "^3.0.0"
4950
},
50-
"peerDependencies": {},
51+
"peerDependencies": {
52+
"postcss": "^8.1.4"
53+
},
5154
"dependencies": {
5255
"@fullhuman/postcss-purgecss": "^3.0.0",
53-
"autoprefixer": "^9.8.6",
56+
"autoprefixer": "^10.0.1",
5457
"bytes": "^3.0.0",
5558
"chalk": "^4.1.0",
5659
"color": "^3.1.3",
@@ -62,10 +65,9 @@
6265
"modern-normalize": "^1.0.0",
6366
"node-emoji": "^1.8.1",
6467
"object-hash": "^2.0.3",
65-
"postcss": "^7",
6668
"postcss-functions": "^3.0.0",
67-
"postcss-js": "^2.0.3",
68-
"postcss-nested": "^4.2.3",
69+
"postcss-js": "^3.0.1",
70+
"postcss-nested": "^5.0.1",
6971
"postcss-selector-parser": "^6.0.4",
7072
"postcss-value-parser": "^4.1.0",
7173
"pretty-hrtime": "^1.0.3",

src/index.js

+11-31
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import resolveConfig from './util/resolveConfig'
1111
import getAllConfigs from './util/getAllConfigs'
1212
import { defaultConfigFile } from './constants'
1313
import defaultConfig from '../stubs/defaultConfig.stub.js'
14-
import postcss from 'postcss'
1514

1615
function resolveConfigPath(filePath) {
1716
// require('tailwindcss')({ theme: ..., variants: ... })
@@ -63,41 +62,22 @@ const getConfigFunction = (config) => () => {
6362
return resolveConfig([...getAllConfigs(configObject)])
6463
}
6564

66-
const plugin = postcss.plugin('tailwind', (config) => {
65+
module.exports = function (config) {
6766
const plugins = []
6867
const resolvedConfigPath = resolveConfigPath(config)
6968

7069
if (!_.isUndefined(resolvedConfigPath)) {
7170
plugins.push(registerConfigAsDependency(resolvedConfigPath))
7271
}
7372

74-
return postcss([
75-
...plugins,
76-
processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
77-
formatCSS,
78-
])
79-
})
80-
81-
module.exports = plugin
82-
83-
// PostCSS 8
84-
// module.exports = function (config) {
85-
// console.log(arguments)
86-
// const plugins = []
87-
// const resolvedConfigPath = resolveConfigPath(config)
88-
89-
// if (!_.isUndefined(resolvedConfigPath)) {
90-
// plugins.push(registerConfigAsDependency(resolvedConfigPath))
91-
// }
92-
93-
// return {
94-
// postcssPlugin: 'tailwindcss',
95-
// plugins: [
96-
// ...plugins,
97-
// processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
98-
// formatCSS,
99-
// ],
100-
// }
101-
// }
73+
return {
74+
postcssPlugin: 'tailwindcss',
75+
plugins: [
76+
...plugins,
77+
processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
78+
formatCSS,
79+
],
80+
}
81+
}
10282

103-
// module.exports.postcss = true
83+
module.exports.postcss = true

yarn.lock

+66-29
Original file line numberDiff line numberDiff line change
@@ -1534,17 +1534,16 @@ atob@^2.1.1:
15341534
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
15351535
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
15361536

1537-
autoprefixer@^9.8.6:
1538-
version "9.8.6"
1539-
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f"
1540-
integrity sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg==
1537+
autoprefixer@^10.0.1:
1538+
version "10.0.1"
1539+
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.0.1.tgz#e2d9000f84ebd98d77b7bc16f8adb2ff1f7bb946"
1540+
integrity sha512-aQo2BDIsoOdemXUAOBpFv4ZQa2DrOtEufarYhtFsK1088Ca0TUwu/aQWf0M3mrILXZ3mTIVn1lR3hPW8acacsw==
15411541
dependencies:
1542-
browserslist "^4.12.0"
1543-
caniuse-lite "^1.0.30001109"
1542+
browserslist "^4.14.5"
1543+
caniuse-lite "^1.0.30001137"
15441544
colorette "^1.2.1"
15451545
normalize-range "^0.1.2"
15461546
num2fraction "^1.2.2"
1547-
postcss "^7.0.32"
15481547
postcss-value-parser "^4.1.0"
15491548

15501549
aws-sign2@~0.7.0:
@@ -1700,6 +1699,16 @@ browserslist@^4.12.0, browserslist@^4.8.3:
17001699
escalade "^3.0.1"
17011700
node-releases "^1.1.58"
17021701

1702+
browserslist@^4.14.5:
1703+
version "4.14.5"
1704+
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.5.tgz#1c751461a102ddc60e40993639b709be7f2c4015"
1705+
integrity sha512-Z+vsCZIvCBvqLoYkBFTwEYH3v5MCQbsAjp50ERycpOjnPmolg1Gjy4+KaWWpm8QOJt9GHkhdqAl14NpCX73CWA==
1706+
dependencies:
1707+
caniuse-lite "^1.0.30001135"
1708+
electron-to-chromium "^1.3.571"
1709+
escalade "^3.1.0"
1710+
node-releases "^1.1.61"
1711+
17031712
bser@^2.0.0:
17041713
version "2.1.0"
17051714
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5"
@@ -1757,10 +1766,10 @@ caniuse-lite@^1.0.30001093:
17571766
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001094.tgz#0b11d02e1cdc201348dbd8e3e57bd9b6ce82b175"
17581767
integrity sha512-ufHZNtMaDEuRBpTbqD93tIQnngmJ+oBknjvr0IbFympSdtFpAUFmNv4mVKbb53qltxFx0nK3iy32S9AqkLzUNA==
17591768

1760-
caniuse-lite@^1.0.30001109:
1761-
version "1.0.30001148"
1762-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001148.tgz#dc97c7ed918ab33bf8706ddd5e387287e015d637"
1763-
integrity sha512-E66qcd0KMKZHNJQt9hiLZGE3J4zuTqE1OnU53miEVtylFbwOEmeA5OsRu90noZful+XGSQOni1aT2tiqu/9yYw==
1769+
caniuse-lite@^1.0.30001135, caniuse-lite@^1.0.30001137:
1770+
version "1.0.30001154"
1771+
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001154.tgz#f3bbc245ce55e4c1cd20fa731b097880181a7f17"
1772+
integrity sha512-y9DvdSti8NnYB9Be92ddMZQrcOe04kcQtcxtBx4NkB04+qZ+JUWotnXBJTmxlKudhxNTQ3RRknMwNU2YQl/Org==
17641773

17651774
capture-exit@^2.0.0:
17661775
version "2.0.0"
@@ -2200,6 +2209,11 @@ electron-to-chromium@^1.3.488:
22002209
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.488.tgz#9226229f5fbc825959210e81e0bb3e63035d1c06"
22012210
integrity sha512-NReBdOugu1yl8ly+0VDtiQ6Yw/1sLjnvflWq0gvY1nfUXU2PbA+1XAVuEb7ModnwL/MfUPjby7e4pAFnSHiy6Q==
22022211

2212+
electron-to-chromium@^1.3.571:
2213+
version "1.3.584"
2214+
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.584.tgz#506cf7ba5895aafa8241876ab028654b61fd9ceb"
2215+
integrity sha512-NB3DzrTzJFhWkUp+nl2KtUtoFzrfGXTir2S+BU4tXGyXH9vlluPuFpE3pTKeH7+PY460tHLjKzh6K2+TWwW+Ww==
2216+
22032217
emittery@^0.7.1:
22042218
version "0.7.1"
22052219
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.1.tgz#c02375a927a40948c0345cc903072597f5270451"
@@ -2262,6 +2276,11 @@ escalade@^3.0.1:
22622276
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.0.1.tgz#52568a77443f6927cd0ab9c73129137533c965ed"
22632277
integrity sha512-DR6NO3h9niOT+MZs7bjxlj2a1k+POu5RN8CLTPX2+i78bRi9eLe7+0zXgUHMnGXWybYcL61E9hGhPKqedy8tQA==
22642278

2279+
escalade@^3.1.0:
2280+
version "3.1.1"
2281+
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
2282+
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
2283+
22652284
escape-string-regexp@^1.0.5:
22662285
version "1.0.5"
22672286
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -3202,7 +3221,7 @@ is-wsl@^2.2.0:
32023221
dependencies:
32033222
is-docker "^2.0.0"
32043223

3205-
[email protected], isarray@~1.0.0:
3224+
[email protected], isarray@^1.0.0, isarray@~1.0.0:
32063225
version "1.0.0"
32073226
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
32083227
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
@@ -3822,6 +3841,14 @@ levn@~0.3.0:
38223841
prelude-ls "~1.1.2"
38233842
type-check "~0.3.2"
38243843

3844+
line-column@^1.0.2:
3845+
version "1.0.2"
3846+
resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2"
3847+
integrity sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI=
3848+
dependencies:
3849+
isarray "^1.0.0"
3850+
isobject "^2.0.0"
3851+
38253852
lines-and-columns@^1.1.6:
38263853
version "1.1.6"
38273854
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
@@ -4024,6 +4051,11 @@ nan@^2.12.1:
40244051
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
40254052
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
40264053

4054+
nanoid@^3.1.15:
4055+
version "3.1.16"
4056+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.16.tgz#b21f0a7d031196faf75314d7c65d36352beeef64"
4057+
integrity sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w==
4058+
40274059
nanomatch@^1.2.9:
40284060
version "1.2.13"
40294061
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -4118,6 +4150,11 @@ node-releases@^1.1.58:
41184150
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.58.tgz#8ee20eef30fa60e52755fcc0942def5a734fe935"
41194151
integrity sha512-NxBudgVKiRh/2aPWMgPR7bPTX0VPmGx5QBwCtdHitnqFE5/O8DeBXuIMH1nwNnw/aMo6AjOrpsHzfY3UbUJ7yg==
41204152

4153+
node-releases@^1.1.61:
4154+
version "1.1.65"
4155+
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.65.tgz#52d9579176bd60f23eba05c4438583f341944b81"
4156+
integrity sha512-YpzJOe2WFIW0V4ZkJQd/DGR/zdVwc/pI4Nl1CZrBO19FdRcSTmsuhdttw9rsTzzJLrNcSloLiBbEYx1C4f6gpA==
4157+
41214158
nopt@^4.0.1:
41224159
version "4.0.1"
41234160
resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
@@ -4483,21 +4520,20 @@ postcss-functions@^3.0.0:
44834520
postcss "^6.0.9"
44844521
postcss-value-parser "^3.3.0"
44854522

4486-
postcss-js@^2.0.3:
4487-
version "2.0.3"
4488-
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-2.0.3.tgz#a96f0f23ff3d08cec7dc5b11bf11c5f8077cdab9"
4489-
integrity sha512-zS59pAk3deu6dVHyrGqmC3oDXBdNdajk4k1RyxeVXCrcEDBUBHoIhE4QTsmhxgzXxsaqFDAkUZfmMa5f/N/79w==
4523+
postcss-js@^3.0.1:
4524+
version "3.0.1"
4525+
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-3.0.1.tgz#e467efdce80ca02e072c60b42e0b35ad2f950a94"
4526+
integrity sha512-m1DgECmEbOK9JhGkdctaP9ZRVheJuEnkk2eb/d3K+5uN10C3S004Ng6Hat4Aha7PsLt824x0xwrT7rVwGRVLHg==
44904527
dependencies:
44914528
camelcase-css "^2.0.1"
4492-
postcss "^7.0.18"
4529+
postcss "^8.1.0"
44934530

4494-
postcss-nested@^4.2.3:
4495-
version "4.2.3"
4496-
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-4.2.3.tgz#c6f255b0a720549776d220d00c4b70cd244136f6"
4497-
integrity sha512-rOv0W1HquRCamWy2kFl3QazJMMe1ku6rCFoAAH+9AcxdbpDeBr6k968MLWuLjvjMcGEip01ak09hKOEgpK9hvw==
4531+
postcss-nested@^5.0.1:
4532+
version "5.0.1"
4533+
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-5.0.1.tgz#e7a77f7a806a09c8de0f2c163d8e3d09f00f3139"
4534+
integrity sha512-ZHNSAoHrMtbEzjq+Qs4R0gHijpXc6F1YUv4TGmGaz7rtfMvVJBbu5hMOH+CrhEaljQpEmx5N/P8i1pXTkbVAmg==
44984535
dependencies:
4499-
postcss "^7.0.32"
4500-
postcss-selector-parser "^6.0.2"
4536+
postcss-selector-parser "^6.0.4"
45014537

45024538
postcss-selector-parser@^6.0.2:
45034539
version "6.0.2"
@@ -4546,14 +4582,15 @@ postcss@^6.0.9:
45464582
source-map "^0.6.1"
45474583
supports-color "^5.4.0"
45484584

4549-
postcss@^7, postcss@^7.0.18, postcss@^7.0.32:
4550-
version "7.0.35"
4551-
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.35.tgz#d2be00b998f7f211d8a276974079f2e92b970e24"
4552-
integrity sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==
4585+
postcss@^8.1.0, postcss@^8.1.4:
4586+
version "8.1.4"
4587+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.1.4.tgz#356dfef367a70f3d04347f74560c85846e20e4c1"
4588+
integrity sha512-LfqcwgMq9LOd8pX7K2+r2HPitlIGC5p6PoZhVELlqhh2YGDVcXKpkCseqan73Hrdik6nBd2OvoDPUaP/oMj9hQ==
45534589
dependencies:
4554-
chalk "^2.4.2"
4590+
colorette "^1.2.1"
4591+
line-column "^1.0.2"
4592+
nanoid "^3.1.15"
45554593
source-map "^0.6.1"
4556-
supports-color "^6.1.0"
45574594

45584595
prelude-ls@^1.2.1:
45594596
version "1.2.1"

0 commit comments

Comments
 (0)