tailwindcss 1.4.1 → 1.4.5

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 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 align="center">
2
- <a href="https://tailwindcss.com/" target="_blank"><img width="200" src="https://tailwindcss.com/img/tailwind.svg"></a><br>
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 align="center">
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>
package/lib/cli/emoji.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.disk = exports.pack = exports.go = exports.no = exports.yes = void 0;
6
+ exports.warning = exports.disk = exports.pack = exports.go = exports.no = exports.yes = void 0;
7
7
 
8
8
  var _nodeEmoji = require("node-emoji");
9
9
 
@@ -16,4 +16,6 @@ exports.go = go;
16
16
  const pack = (0, _nodeEmoji.get)('package');
17
17
  exports.pack = pack;
18
18
  const disk = (0, _nodeEmoji.get)('floppy_disk');
19
- exports.disk = disk;
19
+ exports.disk = disk;
20
+ const warning = (0, _nodeEmoji.get)('warning');
21
+ exports.warning = warning;
@@ -11,6 +11,16 @@ var _postcss = _interopRequireDefault(require("postcss"));
11
11
 
12
12
  var _postcssPurgecss = _interopRequireDefault(require("@fullhuman/postcss-purgecss"));
13
13
 
14
+ var _chalk = _interopRequireDefault(require("chalk"));
15
+
16
+ var _utils = require("../cli/utils");
17
+
18
+ var emoji = _interopRequireWildcard(require("../cli/emoji"));
19
+
20
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
+
22
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
14
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
25
 
16
26
  function removeTailwindComments(css) {
@@ -32,7 +42,7 @@ function removeTailwindComments(css) {
32
42
  }
33
43
 
34
44
  function purgeUnusedUtilities(config) {
35
- const purgeEnabled = _lodash.default.get(config, 'purge.enabled', false) === true || config.purge !== undefined && process.env.NODE_ENV === 'production';
45
+ const purgeEnabled = _lodash.default.get(config, 'purge.enabled', config.purge !== false && config.purge !== undefined && process.env.NODE_ENV === 'production');
36
46
 
37
47
  if (!purgeEnabled) {
38
48
  return removeTailwindComments;
@@ -40,7 +50,10 @@ function purgeUnusedUtilities(config) {
40
50
 
41
51
 
42
52
  if (Array.isArray(config.purge) && config.purge.length === 0) {
43
- console.log('Skipping purge because no template paths provided...');
53
+ (0, _utils.log)();
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'));
44
57
  return removeTailwindComments;
45
58
  }
46
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('textColor'));
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'));
@@ -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'));
@@ -60,6 +60,13 @@ function _default(plugins, config) {
60
60
  postcss: _postcss.default,
61
61
  config: getConfigValue,
62
62
  theme: (path, defaultValue) => getConfigValue(`theme.${path}`, defaultValue),
63
+ corePlugins: path => {
64
+ if (Array.isArray(config.corePlugins)) {
65
+ return config.corePlugins.includes(path);
66
+ }
67
+
68
+ return getConfigValue(`corePlugins.${path}`, true);
69
+ },
63
70
  variants: (path, defaultValue) => {
64
71
  if (Array.isArray(config.variants)) {
65
72
  return config.variants;
@@ -69,7 +76,7 @@ function _default(plugins, config) {
69
76
  },
70
77
  target: path => {
71
78
  if (_lodash.default.isString(config.target)) {
72
- return config.target;
79
+ return config.target === 'browserslist' ? browserslistTarget : config.target;
73
80
  }
74
81
 
75
82
  const [defaultTarget, targetOverrides] = getConfigValue('target');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "1.4.1",
3
+ "version": "1.4.5",
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": "^25.1.0",
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(