tailwindcss 1.4.2 → 1.4.6
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/.eslintrc.json +2 -1
- package/README.md +3 -3
- package/lib/lib/purgeUnusedStyles.js +3 -2
- package/lib/lib/substituteVariantsAtRules.js +4 -0
- package/lib/plugins/backgroundColor.js +6 -3
- package/lib/plugins/borderColor.js +6 -3
- package/lib/plugins/divideColor.js +7 -4
- package/lib/plugins/placeholderColor.js +6 -3
- package/lib/plugins/textColor.js +6 -3
- package/lib/util/processPlugins.js +22 -1
- package/package.json +2 -2
- package/scripts/rebuildFixtures.js +13 -0
package/.eslintrc.json
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"extends": ["eslint-config-postcss", "prettier"],
|
|
10
10
|
"plugins": ["prettier"],
|
|
11
11
|
"rules": {
|
|
12
|
-
"no-unused-vars": [2, {"args": "all", "argsIgnorePattern": "^_"}],
|
|
12
|
+
"no-unused-vars": [2, { "args": "all", "argsIgnorePattern": "^_" }],
|
|
13
|
+
"no-warning-comments": 0,
|
|
13
14
|
"prettier/prettier": [
|
|
14
15
|
"error",
|
|
15
16
|
{
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<p
|
|
2
|
-
<a href="https://tailwindcss.com/" target="_blank"><img width="
|
|
1
|
+
<p>
|
|
2
|
+
<a href="https://tailwindcss.com/" target="_blank"><img width="350" src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo.svg"></a><br>
|
|
3
3
|
A utility-first CSS framework for rapidly building custom user interfaces.
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
|
-
<p
|
|
6
|
+
<p>
|
|
7
7
|
<a href="https://travis-ci.org/tailwindcss/tailwindcss"><img src="https://img.shields.io/travis/tailwindcss/tailwindcss/master.svg" alt="Build Status"></a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
9
9
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
|
@@ -51,8 +51,9 @@ function purgeUnusedUtilities(config) {
|
|
|
51
51
|
|
|
52
52
|
if (Array.isArray(config.purge) && config.purge.length === 0) {
|
|
53
53
|
(0, _utils.log)();
|
|
54
|
-
(0, _utils.log)(emoji.warning, _chalk.default.yellow('
|
|
55
|
-
(0, _utils.log)(_chalk.default.white('
|
|
54
|
+
(0, _utils.log)(emoji.warning, _chalk.default.yellow(' Tailwind is not purging unused styles because no template paths have been provided.'));
|
|
55
|
+
(0, _utils.log)(_chalk.default.white(' If you have manually configured PurgeCSS outside of Tailwind or are deliberately not\n removing unused styles, set `purge: false` in your Tailwind config file to silence\n this warning.'));
|
|
56
|
+
(0, _utils.log)(_chalk.default.white('\n https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css'));
|
|
56
57
|
return removeTailwindComments;
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -105,6 +105,10 @@ function _default(config, {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
_lodash.default.forEach(_lodash.default.without(ensureIncludesDefault(variants), 'responsive'), variant => {
|
|
108
|
+
if (!variantGenerators[variant]) {
|
|
109
|
+
throw new Error(`Your config mentions the "${variant}" variant, but "${variant}" doesn't appear to be a variant. Did you forget or misconfigure a plugin that supplies that variant?`);
|
|
110
|
+
}
|
|
111
|
+
|
|
108
112
|
variantGenerators[variant](atRule, config);
|
|
109
113
|
});
|
|
110
114
|
|
|
@@ -19,7 +19,8 @@ function _default() {
|
|
|
19
19
|
e,
|
|
20
20
|
theme,
|
|
21
21
|
variants,
|
|
22
|
-
target
|
|
22
|
+
target,
|
|
23
|
+
corePlugins
|
|
23
24
|
}) {
|
|
24
25
|
if (target('backgroundColor') === 'ie11') {
|
|
25
26
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('backgroundColor')), (value, modifier) => {
|
|
@@ -33,11 +34,13 @@ function _default() {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('backgroundColor')), (value, modifier) => {
|
|
36
|
-
return [`.${e(`bg-${modifier}`)}`, (0, _withAlphaVariable.default)({
|
|
37
|
+
return [`.${e(`bg-${modifier}`)}`, corePlugins('backgroundOpacity') ? (0, _withAlphaVariable.default)({
|
|
37
38
|
color: value,
|
|
38
39
|
property: 'background-color',
|
|
39
40
|
variable: '--bg-opacity'
|
|
40
|
-
})
|
|
41
|
+
}) : {
|
|
42
|
+
'background-color': value
|
|
43
|
+
}];
|
|
41
44
|
}));
|
|
42
45
|
|
|
43
46
|
addUtilities(utilities, variants('backgroundColor'));
|
|
@@ -19,7 +19,8 @@ function _default() {
|
|
|
19
19
|
e,
|
|
20
20
|
theme,
|
|
21
21
|
variants,
|
|
22
|
-
target
|
|
22
|
+
target,
|
|
23
|
+
corePlugins
|
|
23
24
|
}) {
|
|
24
25
|
if (target('borderColor') === 'ie11') {
|
|
25
26
|
const colors = (0, _flattenColorPalette.default)(theme('borderColor'));
|
|
@@ -37,11 +38,13 @@ function _default() {
|
|
|
37
38
|
const colors = (0, _flattenColorPalette.default)(theme('borderColor'));
|
|
38
39
|
|
|
39
40
|
const utilities = _lodash.default.fromPairs(_lodash.default.map(_lodash.default.omit(colors, 'default'), (value, modifier) => {
|
|
40
|
-
return [`.${e(`border-${modifier}`)}`, (0, _withAlphaVariable.default)({
|
|
41
|
+
return [`.${e(`border-${modifier}`)}`, corePlugins('borderOpacity') ? (0, _withAlphaVariable.default)({
|
|
41
42
|
color: value,
|
|
42
43
|
property: 'border-color',
|
|
43
44
|
variable: '--border-opacity'
|
|
44
|
-
})
|
|
45
|
+
}) : {
|
|
46
|
+
'border-color': value
|
|
47
|
+
}];
|
|
45
48
|
}));
|
|
46
49
|
|
|
47
50
|
addUtilities(utilities, variants('borderColor'));
|
|
@@ -19,7 +19,8 @@ function _default() {
|
|
|
19
19
|
e,
|
|
20
20
|
theme,
|
|
21
21
|
variants,
|
|
22
|
-
target
|
|
22
|
+
target,
|
|
23
|
+
corePlugins
|
|
23
24
|
}) {
|
|
24
25
|
const colors = (0, _flattenColorPalette.default)(theme('divideColor'));
|
|
25
26
|
|
|
@@ -30,16 +31,18 @@ function _default() {
|
|
|
30
31
|
}];
|
|
31
32
|
}));
|
|
32
33
|
|
|
33
|
-
addUtilities(utilities, variants('
|
|
34
|
+
addUtilities(utilities, variants('divideColor'));
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const utilities = _lodash.default.fromPairs(_lodash.default.map(_lodash.default.omit(colors, 'default'), (value, modifier) => {
|
|
38
|
-
return [`.${e(`divide-${modifier}`)} > :not(template) ~ :not(template)`, (0, _withAlphaVariable.default)({
|
|
39
|
+
return [`.${e(`divide-${modifier}`)} > :not(template) ~ :not(template)`, corePlugins('divideOpacity') ? (0, _withAlphaVariable.default)({
|
|
39
40
|
color: value,
|
|
40
41
|
property: 'border-color',
|
|
41
42
|
variable: '--divide-opacity'
|
|
42
|
-
})
|
|
43
|
+
}) : {
|
|
44
|
+
'border-color': value
|
|
45
|
+
}];
|
|
43
46
|
}));
|
|
44
47
|
|
|
45
48
|
addUtilities(utilities, variants('divideColor'));
|
|
@@ -19,7 +19,8 @@ function _default() {
|
|
|
19
19
|
e,
|
|
20
20
|
theme,
|
|
21
21
|
variants,
|
|
22
|
-
target
|
|
22
|
+
target,
|
|
23
|
+
corePlugins
|
|
23
24
|
}) {
|
|
24
25
|
if (target('placeholderColor') === 'ie11') {
|
|
25
26
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('placeholderColor')), (value, modifier) => {
|
|
@@ -33,11 +34,13 @@ function _default() {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('placeholderColor')), (value, modifier) => {
|
|
36
|
-
return [`.${e(`placeholder-${modifier}`)}::placeholder`, (0, _withAlphaVariable.default)({
|
|
37
|
+
return [`.${e(`placeholder-${modifier}`)}::placeholder`, corePlugins('placeholderOpacity') ? (0, _withAlphaVariable.default)({
|
|
37
38
|
color: value,
|
|
38
39
|
property: 'color',
|
|
39
40
|
variable: '--placeholder-opacity'
|
|
40
|
-
})
|
|
41
|
+
}) : {
|
|
42
|
+
color: value
|
|
43
|
+
}];
|
|
41
44
|
}));
|
|
42
45
|
|
|
43
46
|
addUtilities(utilities, variants('placeholderColor'));
|
package/lib/plugins/textColor.js
CHANGED
|
@@ -19,7 +19,8 @@ function _default() {
|
|
|
19
19
|
e,
|
|
20
20
|
theme,
|
|
21
21
|
variants,
|
|
22
|
-
target
|
|
22
|
+
target,
|
|
23
|
+
corePlugins
|
|
23
24
|
}) {
|
|
24
25
|
if (target('textColor') === 'ie11') {
|
|
25
26
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('textColor')), (value, modifier) => {
|
|
@@ -33,11 +34,13 @@ function _default() {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const utilities = _lodash.default.fromPairs(_lodash.default.map((0, _flattenColorPalette.default)(theme('textColor')), (value, modifier) => {
|
|
36
|
-
return [`.${e(`text-${modifier}`)}`, (0, _withAlphaVariable.default)({
|
|
37
|
+
return [`.${e(`text-${modifier}`)}`, corePlugins('textOpacity') ? (0, _withAlphaVariable.default)({
|
|
37
38
|
color: value,
|
|
38
39
|
property: 'color',
|
|
39
40
|
variable: '--text-opacity'
|
|
40
|
-
})
|
|
41
|
+
}) : {
|
|
42
|
+
color: value
|
|
43
|
+
}];
|
|
41
44
|
}));
|
|
42
45
|
|
|
43
46
|
addUtilities(utilities, variants('textColor'));
|
|
@@ -27,6 +27,8 @@ var _wrapWithVariants = _interopRequireDefault(require("../util/wrapWithVariants
|
|
|
27
27
|
|
|
28
28
|
var _increaseSpecificity = _interopRequireDefault(require("../util/increaseSpecificity"));
|
|
29
29
|
|
|
30
|
+
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
function parseStyles(styles) {
|
|
@@ -37,6 +39,14 @@ function parseStyles(styles) {
|
|
|
37
39
|
return _lodash.default.flatMap(styles, style => style instanceof _node.default ? style : (0, _parseObjectStyles.default)(style));
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
function containsClass(value) {
|
|
43
|
+
return (0, _postcssSelectorParser.default)(selectors => {
|
|
44
|
+
let classFound = false;
|
|
45
|
+
selectors.walkClasses(() => classFound = true);
|
|
46
|
+
return classFound;
|
|
47
|
+
}).transformSync(value);
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
function _default(plugins, config) {
|
|
41
51
|
const pluginBaseStyles = [];
|
|
42
52
|
const pluginComponents = [];
|
|
@@ -60,6 +70,13 @@ function _default(plugins, config) {
|
|
|
60
70
|
postcss: _postcss.default,
|
|
61
71
|
config: getConfigValue,
|
|
62
72
|
theme: (path, defaultValue) => getConfigValue(`theme.${path}`, defaultValue),
|
|
73
|
+
corePlugins: path => {
|
|
74
|
+
if (Array.isArray(config.corePlugins)) {
|
|
75
|
+
return config.corePlugins.includes(path);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return getConfigValue(`corePlugins.${path}`, true);
|
|
79
|
+
},
|
|
63
80
|
variants: (path, defaultValue) => {
|
|
64
81
|
if (Array.isArray(config.variants)) {
|
|
65
82
|
return config.variants;
|
|
@@ -69,7 +86,7 @@ function _default(plugins, config) {
|
|
|
69
86
|
},
|
|
70
87
|
target: path => {
|
|
71
88
|
if (_lodash.default.isString(config.target)) {
|
|
72
|
-
return config.target;
|
|
89
|
+
return config.target === 'browserslist' ? browserslistTarget : config.target;
|
|
73
90
|
}
|
|
74
91
|
|
|
75
92
|
const [defaultTarget, targetOverrides] = getConfigValue('target');
|
|
@@ -103,6 +120,10 @@ function _default(plugins, config) {
|
|
|
103
120
|
if (config.important === true) {
|
|
104
121
|
rule.walkDecls(decl => decl.important = true);
|
|
105
122
|
} else if (typeof config.important === 'string') {
|
|
123
|
+
if (containsClass(config.important)) {
|
|
124
|
+
throw rule.error(`Classes are not allowed when using the \`important\` option with a string argument. Please use an ID instead.`);
|
|
125
|
+
}
|
|
126
|
+
|
|
106
127
|
rule.selectors = rule.selectors.map(selector => {
|
|
107
128
|
return (0, _increaseSpecificity.default)(config.important, selector);
|
|
108
129
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/core": "^7.0.0",
|
|
31
31
|
"@babel/node": "^7.0.0",
|
|
32
32
|
"@babel/preset-env": "^7.0.0",
|
|
33
|
-
"babel-jest": "^
|
|
33
|
+
"babel-jest": "^26.0.0",
|
|
34
34
|
"clean-css": "^4.1.9",
|
|
35
35
|
"eslint": "^6.0.1",
|
|
36
36
|
"eslint-config-postcss": "^2.0.2",
|
|
@@ -44,6 +44,19 @@ Promise.all([
|
|
|
44
44
|
to: '__tests__/fixtures/tailwind-output-ie11.css',
|
|
45
45
|
config: { target: 'ie11' },
|
|
46
46
|
}),
|
|
47
|
+
build({
|
|
48
|
+
from: '__tests__/fixtures/tailwind-input.css',
|
|
49
|
+
to: '__tests__/fixtures/tailwind-output-no-color-opacity.css',
|
|
50
|
+
config: {
|
|
51
|
+
corePlugins: {
|
|
52
|
+
textOpacity: false,
|
|
53
|
+
backgroundOpacity: false,
|
|
54
|
+
borderOpacity: false,
|
|
55
|
+
placeholderOpacity: false,
|
|
56
|
+
divideOpacity: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
47
60
|
]).then(() => {
|
|
48
61
|
console.log('\nFinished rebuilding fixtures.')
|
|
49
62
|
console.log(
|