tailwindcss 3.0.14 → 3.0.18

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/src/cli.js CHANGED
@@ -437,7 +437,6 @@ async function build() {
437
437
 
438
438
  function resolveConfig() {
439
439
  let config = configPath ? require(configPath) : {}
440
- let resolvedConfig = resolveConfigInternal(config)
441
440
 
442
441
  if (args['--purge']) {
443
442
  log.warn('purge-flag-deprecated', [
@@ -450,10 +449,13 @@ async function build() {
450
449
  }
451
450
 
452
451
  if (args['--content']) {
453
- resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/)
452
+ let files = args['--content'].split(/(?<!{[^}]+),/)
453
+ let resolvedConfig = resolveConfigInternal(config, { content: { files } })
454
+ resolvedConfig.content.files = files
455
+ return resolvedConfig
454
456
  }
455
457
 
456
- return resolvedConfig
458
+ return resolveConfigInternal(config)
457
459
  }
458
460
 
459
461
  function extractFileGlobs(config) {
@@ -144,6 +144,7 @@ export let variantPlugins = {
144
144
  log.warn('darkmode-false', [
145
145
  'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
146
146
  'Change `darkMode` to `media` or remove it entirely.',
147
+ 'https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration',
147
148
  ])
148
149
  }
149
150
 
@@ -247,7 +247,8 @@ export default function expandTailwindAtRules(context) {
247
247
 
248
248
  if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
249
249
  log.warn('content-problems', [
250
- 'No utilities were generated there is likely a problem with the `content` key in the tailwind config. For more information see the documentation: https://tailwindcss.com/docs/content-configuration',
250
+ 'No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.',
251
+ 'https://tailwindcss.com/docs/content-configuration',
251
252
  ])
252
253
  }
253
254
 
@@ -262,7 +262,8 @@ function parseRules(rule, cache, options = {}) {
262
262
  const IS_VALID_PROPERTY_NAME = /^[a-z_-]/
263
263
 
264
264
  function isValidPropName(name) {
265
- return IS_VALID_PROPERTY_NAME.test(name)
265
+ // TODO: properly fix this!
266
+ return IS_VALID_PROPERTY_NAME.test(name) && !name.startsWith('http')
266
267
  }
267
268
 
268
269
  function isParsableCssValue(property, value) {
@@ -49,6 +49,7 @@ export default function normalizeTailwindDirectives(root) {
49
49
  log.warn(`${atRule.name}-at-rule-deprecated`, [
50
50
  `The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
51
51
  `Use \`@layer utilities\` or \`@layer components\` instead.`,
52
+ 'https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer',
52
53
  ])
53
54
  }
54
55
  layerDirectives.add(atRule)
@@ -656,7 +656,7 @@ function registerPlugins(plugins, context) {
656
656
  log.warn('root-regex', [
657
657
  'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
658
658
  'Update your `safelist` configuration to eliminate this warning.',
659
- // TODO: Add https://tw.wtf/regex-safelist
659
+ 'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
660
660
  ])
661
661
  continue
662
662
  }
@@ -714,6 +714,7 @@ function registerPlugins(plugins, context) {
714
714
  log.warn([
715
715
  `The safelist pattern \`${regex}\` doesn't match any Tailwind CSS classes.`,
716
716
  'Fix this pattern or remove it from your `safelist` configuration.',
717
+ 'https://tailwindcss.com/docs/content-configuration#safelisting-classes',
717
718
  ])
718
719
  }
719
720
  }
@@ -0,0 +1,42 @@
1
+ # tailwindcss/nesting
2
+
3
+ This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
4
+
5
+ Add it to your PostCSS configuration, somewhere before Tailwind itself:
6
+
7
+ ```js
8
+ // postcss.config.js
9
+ module.exports = {
10
+ plugins: [
11
+ require('postcss-import'),
12
+ require('tailwindcss/nesting'),
13
+ require('tailwindcss'),
14
+ require('autoprefixer'),
15
+ ]
16
+ }
17
+ ```
18
+
19
+ By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
20
+
21
+ If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
22
+
23
+ ```shell
24
+ npm install postcss-nesting
25
+ ```
26
+
27
+ Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
28
+
29
+ ```js
30
+ // postcss.config.js
31
+ module.exports = {
32
+ plugins: [
33
+ require('postcss-import'),
34
+ require('tailwindcss/nesting')(require('postcss-nesting')),
35
+ require('tailwindcss'),
36
+ require('autoprefixer'),
37
+ ]
38
+ }
39
+ ```
40
+
41
+ This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
42
+
@@ -0,0 +1,13 @@
1
+ import { nesting } from './plugin'
2
+
3
+ export default Object.assign(
4
+ function (opts) {
5
+ return {
6
+ postcssPlugin: 'tailwindcss/nesting',
7
+ Once(root, { result }) {
8
+ return nesting(opts)(root, result)
9
+ },
10
+ }
11
+ },
12
+ { postcss: true }
13
+ )
@@ -1,7 +1,7 @@
1
- let postcss = require('postcss')
2
- let postcssNested = require('postcss-nested')
1
+ import postcss from 'postcss'
2
+ import postcssNested from 'postcss-nested'
3
3
 
4
- module.exports = function nesting(opts = postcssNested) {
4
+ export function nesting(opts = postcssNested) {
5
5
  return (root, result) => {
6
6
  root.walkAtRules('screen', (rule) => {
7
7
  rule.name = 'media'
@@ -16,7 +16,7 @@ module.exports = function nesting(opts = postcssNested) {
16
16
  let plugin = (() => {
17
17
  if (
18
18
  typeof opts === 'function' ||
19
- (typeof opts === 'object' && opts?.hasOwnProperty('postcssPlugin'))
19
+ (typeof opts === 'object' && opts?.hasOwnProperty?.('postcssPlugin'))
20
20
  ) {
21
21
  return opts
22
22
  }
@@ -16,6 +16,9 @@ export default function processTailwindFeatures(setupContext) {
16
16
  let { tailwindDirectives, applyDirectives } = normalizeTailwindDirectives(root)
17
17
 
18
18
  detectNesting()(root, result)
19
+
20
+ // Partition apply rules that are found in the css
21
+ // itself.
19
22
  partitionApplyAtRules()(root, result)
20
23
 
21
24
  let context = setupContext({
@@ -42,6 +45,9 @@ export default function processTailwindFeatures(setupContext) {
42
45
  issueFlagNotices(context.tailwindConfig)
43
46
 
44
47
  expandTailwindAtRules(context)(root, result)
48
+ // Partition apply rules that are generated by
49
+ // addComponents, addUtilities and so on.
50
+ partitionApplyAtRules()(root, result)
45
51
  expandApplyAtRules(context)(root, result)
46
52
  evaluateTailwindFunctions(context)(root, result)
47
53
  substituteScreenAtRules(context)(root, result)
@@ -124,7 +124,7 @@ export function normalizeConfig(config) {
124
124
  log.warn('purge-deprecation', [
125
125
  'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
126
126
  'Update your configuration file to eliminate this warning.',
127
- // TODO: Add https://tw.wtf/purge-deprecation
127
+ 'https://tailwindcss.com/docs/upgrade-guide#configure-content-sources',
128
128
  ])
129
129
  }
130
130
 
@@ -145,7 +145,7 @@ export function normalizeConfig(config) {
145
145
  log.warn('prefix-function', [
146
146
  'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
147
147
  'Update `prefix` in your configuration to be a string to eliminate this warning.',
148
- // TODO: Add https://tw.wtf/prefix-function
148
+ 'https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function',
149
149
  ])
150
150
  config.prefix = ''
151
151
  } else {
@@ -250,8 +250,8 @@ export function normalizeConfig(config) {
250
250
  for (let file of config.content.files) {
251
251
  if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
252
252
  log.warn('invalid-glob-braces', [
253
- `The glob pattern ${dim(file)} in your config is invalid.`,
254
- ` Update it to ${dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`,
253
+ `The glob pattern ${dim(file)} in your Tailwind CSS configuration is invalid.`,
254
+ `Update it to ${dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`,
255
255
  // TODO: Add https://tw.wtf/invalid-glob-braces
256
256
  ])
257
257
  break
@@ -260,7 +260,9 @@ export function normalizeConfig(config) {
260
260
 
261
261
  if (config.content.files.length === 0) {
262
262
  log.warn('content-problems', [
263
- 'The `content` key is missing or empty. Please populate the content key as Tailwind generates utilities on-demand based on the files that use them. For more information see the documentation: https://tailwindcss.com/docs/content-configuration',
263
+ 'The `content` option in your Tailwind CSS configuration is missing or empty.',
264
+ 'Configure your content sources or your generated CSS will be missing styles.',
265
+ 'https://tailwindcss.com/docs/content-configuration',
264
266
  ])
265
267
  }
266
268