tailwindcss 3.0.9 → 3.0.10
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/CHANGELOG.md +13 -1
- package/lib/cli.js +49 -12
- package/lib/lib/expandTailwindAtRules.js +17 -8
- package/lib/lib/normalizeTailwindDirectives.js +8 -1
- package/lib/lib/setupTrackingContext.js +11 -10
- package/lib/processTailwindFeatures.js +2 -1
- package/package.json +1 -1
- package/src/cli.js +57 -12
- package/src/lib/expandTailwindAtRules.js +19 -8
- package/src/lib/normalizeTailwindDirectives.js +6 -1
- package/src/lib/setupTrackingContext.js +11 -10
- package/src/processTailwindFeatures.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Nothing yet!
|
|
11
11
|
|
|
12
|
+
## [3.0.10] - 2022-01-04
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix `@apply` in files without `@tailwind` directives ([#6580](https://github.com/tailwindlabs/tailwindcss/pull/6580), [#6875](https://github.com/tailwindlabs/tailwindcss/pull/6875))
|
|
17
|
+
- CLI: avoid unnecessary writes to output files ([#6550](https://github.com/tailwindlabs/tailwindcss/pull/6550))
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Allow piping data into the CLI ([#6876](https://github.com/tailwindlabs/tailwindcss/pull/6876))
|
|
22
|
+
|
|
12
23
|
## [3.0.9] - 2022-01-03
|
|
13
24
|
|
|
14
25
|
### Fixed
|
|
@@ -1760,7 +1771,8 @@ No release notes
|
|
|
1760
1771
|
|
|
1761
1772
|
- Everything!
|
|
1762
1773
|
|
|
1763
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.
|
|
1774
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.10...HEAD
|
|
1775
|
+
[3.0.10]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.9...v3.0.10
|
|
1764
1776
|
[3.0.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.8...v3.0.9
|
|
1765
1777
|
[3.0.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...v3.0.8
|
|
1766
1778
|
[3.0.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.6...v3.0.7
|
package/lib/cli.js
CHANGED
|
@@ -40,6 +40,25 @@ function formatNodes(root) {
|
|
|
40
40
|
root.first.raws.before = '';
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
async function outputFile(file, contents) {
|
|
44
|
+
if (_fs.default.existsSync(file) && await _fs.default.promises.readFile(file, 'utf8') === contents) {
|
|
45
|
+
return; // Skip writing the file
|
|
46
|
+
}
|
|
47
|
+
// Write the file
|
|
48
|
+
await _fs.default.promises.writeFile(file, contents, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
function drainStdin() {
|
|
51
|
+
return new Promise((resolve, reject)=>{
|
|
52
|
+
let result = '';
|
|
53
|
+
process.stdin.on('data', (chunk)=>{
|
|
54
|
+
result += chunk;
|
|
55
|
+
});
|
|
56
|
+
process.stdin.on('end', ()=>resolve(result)
|
|
57
|
+
);
|
|
58
|
+
process.stdin.on('error', (err)=>reject(err)
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
43
62
|
function help({ message , usage , commands: commands1 , options }) {
|
|
44
63
|
let indent = 2;
|
|
45
64
|
// Render header
|
|
@@ -336,7 +355,7 @@ async function build() {
|
|
|
336
355
|
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
|
|
337
356
|
input = args['--input'] = args['_'][1];
|
|
338
357
|
}
|
|
339
|
-
if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
358
|
+
if (input && input !== '-' && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
340
359
|
console.error(`Specified input file ${args['--input']} does not exist.`);
|
|
341
360
|
process.exit(9);
|
|
342
361
|
}
|
|
@@ -499,10 +518,8 @@ async function build() {
|
|
|
499
518
|
return process.stdout.write(result.css);
|
|
500
519
|
}
|
|
501
520
|
return Promise.all([
|
|
502
|
-
|
|
503
|
-
),
|
|
504
|
-
result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
|
|
505
|
-
),
|
|
521
|
+
outputFile(output, result.css),
|
|
522
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
506
523
|
].filter(Boolean));
|
|
507
524
|
}).then(()=>{
|
|
508
525
|
let end = process.hrtime.bigint();
|
|
@@ -510,7 +527,18 @@ async function build() {
|
|
|
510
527
|
console.error('Done in', (end - start) / BigInt(1000000) + 'ms.');
|
|
511
528
|
});
|
|
512
529
|
}
|
|
513
|
-
let css1 =
|
|
530
|
+
let css1 = await (()=>{
|
|
531
|
+
// Piping in data, let's drain the stdin
|
|
532
|
+
if (input === '-') {
|
|
533
|
+
return drainStdin();
|
|
534
|
+
}
|
|
535
|
+
// Input file has been provided
|
|
536
|
+
if (input) {
|
|
537
|
+
return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
|
|
538
|
+
}
|
|
539
|
+
// No input file provided, fallback to default atrules
|
|
540
|
+
return '@tailwind base; @tailwind components; @tailwind utilities';
|
|
541
|
+
})();
|
|
514
542
|
return processCSS(css1);
|
|
515
543
|
}
|
|
516
544
|
let context = null;
|
|
@@ -619,11 +647,9 @@ async function build() {
|
|
|
619
647
|
if (!output) {
|
|
620
648
|
return process.stdout.write(result.css);
|
|
621
649
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
),
|
|
625
|
-
result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
|
|
626
|
-
),
|
|
650
|
+
return Promise.all([
|
|
651
|
+
outputFile(output, result.css),
|
|
652
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
627
653
|
].filter(Boolean));
|
|
628
654
|
}).then(()=>{
|
|
629
655
|
let end = process.hrtime.bigint();
|
|
@@ -636,7 +662,18 @@ async function build() {
|
|
|
636
662
|
}
|
|
637
663
|
});
|
|
638
664
|
}
|
|
639
|
-
let css2 =
|
|
665
|
+
let css2 = await (()=>{
|
|
666
|
+
// Piping in data, let's drain the stdin
|
|
667
|
+
if (input === '-') {
|
|
668
|
+
return drainStdin();
|
|
669
|
+
}
|
|
670
|
+
// Input file has been provided
|
|
671
|
+
if (input) {
|
|
672
|
+
return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
|
|
673
|
+
}
|
|
674
|
+
// No input file provided, fallback to default atrules
|
|
675
|
+
return '@tailwind base; @tailwind components; @tailwind utilities';
|
|
676
|
+
})();
|
|
640
677
|
let result1 = await processCSS(css2);
|
|
641
678
|
env.DEBUG && console.timeEnd('Finished in');
|
|
642
679
|
return result1;
|
|
@@ -143,17 +143,26 @@ function expandTailwindAtRules(context) {
|
|
|
143
143
|
utilities: null,
|
|
144
144
|
variants: null
|
|
145
145
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
let hasApply = false;
|
|
147
|
+
root.walkAtRules((rule)=>{
|
|
148
|
+
// Make sure this file contains Tailwind directives. If not, we can save
|
|
149
|
+
// a lot of work and bail early. Also we don't have to register our touch
|
|
150
|
+
// file as a dependency since the output of this CSS does not depend on
|
|
151
|
+
// the source of any templates. Think Vue <style> blocks for example.
|
|
152
|
+
if (rule.name === 'tailwind') {
|
|
153
|
+
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
154
|
+
layerNodes[rule.params] = rule;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// We also want to check for @apply because the user can
|
|
158
|
+
// apply classes in an isolated environment like CSS
|
|
159
|
+
// modules and we still need to inject defaults
|
|
160
|
+
if (rule.name === 'apply') {
|
|
161
|
+
hasApply = true;
|
|
153
162
|
}
|
|
154
163
|
});
|
|
155
164
|
if (Object.values(layerNodes).every((n)=>n === null
|
|
156
|
-
)) {
|
|
165
|
+
) && !hasApply) {
|
|
157
166
|
return root;
|
|
158
167
|
}
|
|
159
168
|
// ---
|
|
@@ -12,7 +12,11 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
function normalizeTailwindDirectives(root) {
|
|
13
13
|
let tailwindDirectives = new Set();
|
|
14
14
|
let layerDirectives = new Set();
|
|
15
|
+
let applyDirectives = new Set();
|
|
15
16
|
root.walkAtRules((atRule)=>{
|
|
17
|
+
if (atRule.name === 'apply') {
|
|
18
|
+
applyDirectives.add(atRule);
|
|
19
|
+
}
|
|
16
20
|
if (atRule.name === 'import') {
|
|
17
21
|
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
|
|
18
22
|
atRule.name = 'tailwind';
|
|
@@ -72,5 +76,8 @@ function normalizeTailwindDirectives(root) {
|
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
|
-
return
|
|
79
|
+
return {
|
|
80
|
+
tailwindDirectives,
|
|
81
|
+
applyDirectives
|
|
82
|
+
};
|
|
76
83
|
}
|
|
@@ -119,16 +119,17 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
|
119
119
|
return changedFiles;
|
|
120
120
|
}
|
|
121
121
|
function setupTrackingContext(configOrPath) {
|
|
122
|
-
return ({ tailwindDirectives , registerDependency })=>{
|
|
122
|
+
return ({ tailwindDirectives , registerDependency , applyDirectives })=>{
|
|
123
123
|
return (root, result)=>{
|
|
124
124
|
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
125
125
|
let contextDependencies = new Set(configDependencies);
|
|
126
|
-
// If there are no @tailwind rules, we don't consider this CSS
|
|
127
|
-
// to be dependencies of the context. Can reuse
|
|
128
|
-
// We may want to think about `@layer`
|
|
129
|
-
//
|
|
130
|
-
// in
|
|
131
|
-
|
|
126
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
127
|
+
// file or its dependencies to be dependencies of the context. Can reuse
|
|
128
|
+
// the context even if they change. We may want to think about `@layer`
|
|
129
|
+
// being part of this trigger too, but it's tough because it's impossible
|
|
130
|
+
// for a layer in one file to end up in the actual @tailwind rule in
|
|
131
|
+
// another file since independent sources are effectively isolated.
|
|
132
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
132
133
|
// Add current css file as a context dependencies.
|
|
133
134
|
contextDependencies.add(result.opts.from);
|
|
134
135
|
// Add all css @import dependencies as context dependencies.
|
|
@@ -140,12 +141,12 @@ function setupTrackingContext(configOrPath) {
|
|
|
140
141
|
}
|
|
141
142
|
let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
142
143
|
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
143
|
-
// If there are no @tailwind rules, we don't consider this CSS file or it's
|
|
144
|
-
// to be dependencies of the context. Can reuse the context even if they change.
|
|
144
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
145
|
+
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
145
146
|
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
146
147
|
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
147
148
|
// in another file since independent sources are effectively isolated.
|
|
148
|
-
if (tailwindDirectives.size > 0) {
|
|
149
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
149
150
|
let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
|
|
150
151
|
// Add template paths as postcss dependencies.
|
|
151
152
|
for (let fileOrGlob of candidateFiles){
|
|
@@ -21,9 +21,10 @@ function _interopRequireDefault(obj) {
|
|
|
21
21
|
}
|
|
22
22
|
function processTailwindFeatures(setupContext) {
|
|
23
23
|
return function(root, result) {
|
|
24
|
-
let tailwindDirectives = (0, _normalizeTailwindDirectives).default(root);
|
|
24
|
+
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
|
|
25
25
|
let context = setupContext({
|
|
26
26
|
tailwindDirectives,
|
|
27
|
+
applyDirectives,
|
|
27
28
|
registerDependency (dependency) {
|
|
28
29
|
result.messages.push({
|
|
29
30
|
plugin: 'tailwindcss',
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -41,6 +41,26 @@ function formatNodes(root) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
async function outputFile(file, contents) {
|
|
45
|
+
if (fs.existsSync(file) && (await fs.promises.readFile(file, 'utf8')) === contents) {
|
|
46
|
+
return // Skip writing the file
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Write the file
|
|
50
|
+
await fs.promises.writeFile(file, contents, 'utf8')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function drainStdin() {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
let result = ''
|
|
56
|
+
process.stdin.on('data', (chunk) => {
|
|
57
|
+
result += chunk
|
|
58
|
+
})
|
|
59
|
+
process.stdin.on('end', () => resolve(result))
|
|
60
|
+
process.stdin.on('error', (err) => reject(err))
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
function help({ message, usage, commands, options }) {
|
|
45
65
|
let indent = 2
|
|
46
66
|
|
|
@@ -355,7 +375,7 @@ async function build() {
|
|
|
355
375
|
input = args['--input'] = args['_'][1]
|
|
356
376
|
}
|
|
357
377
|
|
|
358
|
-
if (input && !fs.existsSync((input = path.resolve(input)))) {
|
|
378
|
+
if (input && input !== '-' && !fs.existsSync((input = path.resolve(input)))) {
|
|
359
379
|
console.error(`Specified input file ${args['--input']} does not exist.`)
|
|
360
380
|
process.exit(9)
|
|
361
381
|
}
|
|
@@ -534,10 +554,11 @@ async function build() {
|
|
|
534
554
|
if (!output) {
|
|
535
555
|
return process.stdout.write(result.css)
|
|
536
556
|
}
|
|
557
|
+
|
|
537
558
|
return Promise.all(
|
|
538
559
|
[
|
|
539
|
-
|
|
540
|
-
result.map &&
|
|
560
|
+
outputFile(output, result.css),
|
|
561
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
541
562
|
].filter(Boolean)
|
|
542
563
|
)
|
|
543
564
|
})
|
|
@@ -548,9 +569,21 @@ async function build() {
|
|
|
548
569
|
})
|
|
549
570
|
}
|
|
550
571
|
|
|
551
|
-
let css =
|
|
552
|
-
|
|
553
|
-
|
|
572
|
+
let css = await (() => {
|
|
573
|
+
// Piping in data, let's drain the stdin
|
|
574
|
+
if (input === '-') {
|
|
575
|
+
return drainStdin()
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Input file has been provided
|
|
579
|
+
if (input) {
|
|
580
|
+
return fs.readFileSync(path.resolve(input), 'utf8')
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// No input file provided, fallback to default atrules
|
|
584
|
+
return '@tailwind base; @tailwind components; @tailwind utilities'
|
|
585
|
+
})()
|
|
586
|
+
|
|
554
587
|
return processCSS(css)
|
|
555
588
|
}
|
|
556
589
|
|
|
@@ -664,10 +697,10 @@ async function build() {
|
|
|
664
697
|
return process.stdout.write(result.css)
|
|
665
698
|
}
|
|
666
699
|
|
|
667
|
-
|
|
700
|
+
return Promise.all(
|
|
668
701
|
[
|
|
669
|
-
|
|
670
|
-
result.map &&
|
|
702
|
+
outputFile(output, result.css),
|
|
703
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
671
704
|
].filter(Boolean)
|
|
672
705
|
)
|
|
673
706
|
})
|
|
@@ -684,9 +717,21 @@ async function build() {
|
|
|
684
717
|
})
|
|
685
718
|
}
|
|
686
719
|
|
|
687
|
-
let css =
|
|
688
|
-
|
|
689
|
-
|
|
720
|
+
let css = await (() => {
|
|
721
|
+
// Piping in data, let's drain the stdin
|
|
722
|
+
if (input === '-') {
|
|
723
|
+
return drainStdin()
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// Input file has been provided
|
|
727
|
+
if (input) {
|
|
728
|
+
return fs.readFileSync(path.resolve(input), 'utf8')
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// No input file provided, fallback to default atrules
|
|
732
|
+
return '@tailwind base; @tailwind components; @tailwind utilities'
|
|
733
|
+
})()
|
|
734
|
+
|
|
690
735
|
let result = await processCSS(css)
|
|
691
736
|
env.DEBUG && console.timeEnd('Finished in')
|
|
692
737
|
return result
|
|
@@ -140,17 +140,28 @@ export default function expandTailwindAtRules(context) {
|
|
|
140
140
|
variants: null,
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
let hasApply = false
|
|
144
|
+
|
|
145
|
+
root.walkAtRules((rule) => {
|
|
146
|
+
// Make sure this file contains Tailwind directives. If not, we can save
|
|
147
|
+
// a lot of work and bail early. Also we don't have to register our touch
|
|
148
|
+
// file as a dependency since the output of this CSS does not depend on
|
|
149
|
+
// the source of any templates. Think Vue <style> blocks for example.
|
|
150
|
+
if (rule.name === 'tailwind') {
|
|
151
|
+
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
152
|
+
layerNodes[rule.params] = rule
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// We also want to check for @apply because the user can
|
|
157
|
+
// apply classes in an isolated environment like CSS
|
|
158
|
+
// modules and we still need to inject defaults
|
|
159
|
+
if (rule.name === 'apply') {
|
|
160
|
+
hasApply = true
|
|
150
161
|
}
|
|
151
162
|
})
|
|
152
163
|
|
|
153
|
-
if (Object.values(layerNodes).every((n) => n === null)) {
|
|
164
|
+
if (Object.values(layerNodes).every((n) => n === null) && !hasApply) {
|
|
154
165
|
return root
|
|
155
166
|
}
|
|
156
167
|
|
|
@@ -3,8 +3,13 @@ import log from '../util/log'
|
|
|
3
3
|
export default function normalizeTailwindDirectives(root) {
|
|
4
4
|
let tailwindDirectives = new Set()
|
|
5
5
|
let layerDirectives = new Set()
|
|
6
|
+
let applyDirectives = new Set()
|
|
6
7
|
|
|
7
8
|
root.walkAtRules((atRule) => {
|
|
9
|
+
if (atRule.name === 'apply') {
|
|
10
|
+
applyDirectives.add(atRule)
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
if (atRule.name === 'import') {
|
|
9
14
|
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
|
|
10
15
|
atRule.name = 'tailwind'
|
|
@@ -74,5 +79,5 @@ export default function normalizeTailwindDirectives(root) {
|
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
return tailwindDirectives
|
|
82
|
+
return { tailwindDirectives, applyDirectives }
|
|
78
83
|
}
|
|
@@ -112,19 +112,20 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
|
112
112
|
// source path), or set up a new one (including setting up watchers and registering
|
|
113
113
|
// plugins) then return it
|
|
114
114
|
export default function setupTrackingContext(configOrPath) {
|
|
115
|
-
return ({ tailwindDirectives, registerDependency }) => {
|
|
115
|
+
return ({ tailwindDirectives, registerDependency, applyDirectives }) => {
|
|
116
116
|
return (root, result) => {
|
|
117
117
|
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] =
|
|
118
118
|
getTailwindConfig(configOrPath)
|
|
119
119
|
|
|
120
120
|
let contextDependencies = new Set(configDependencies)
|
|
121
121
|
|
|
122
|
-
// If there are no @tailwind rules, we don't consider this CSS
|
|
123
|
-
// to be dependencies of the context. Can reuse
|
|
124
|
-
// We may want to think about `@layer`
|
|
125
|
-
//
|
|
126
|
-
// in
|
|
127
|
-
|
|
122
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
123
|
+
// file or its dependencies to be dependencies of the context. Can reuse
|
|
124
|
+
// the context even if they change. We may want to think about `@layer`
|
|
125
|
+
// being part of this trigger too, but it's tough because it's impossible
|
|
126
|
+
// for a layer in one file to end up in the actual @tailwind rule in
|
|
127
|
+
// another file since independent sources are effectively isolated.
|
|
128
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
128
129
|
// Add current css file as a context dependencies.
|
|
129
130
|
contextDependencies.add(result.opts.from)
|
|
130
131
|
|
|
@@ -147,12 +148,12 @@ export default function setupTrackingContext(configOrPath) {
|
|
|
147
148
|
|
|
148
149
|
let candidateFiles = getCandidateFiles(context, tailwindConfig)
|
|
149
150
|
|
|
150
|
-
// If there are no @tailwind rules, we don't consider this CSS file or it's
|
|
151
|
-
// to be dependencies of the context. Can reuse the context even if they change.
|
|
151
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
152
|
+
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
152
153
|
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
153
154
|
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
154
155
|
// in another file since independent sources are effectively isolated.
|
|
155
|
-
if (tailwindDirectives.size > 0) {
|
|
156
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
156
157
|
let fileModifiedMap = getFileModifiedMap(context)
|
|
157
158
|
|
|
158
159
|
// Add template paths as postcss dependencies.
|
|
@@ -12,10 +12,11 @@ import { issueFlagNotices } from './featureFlags'
|
|
|
12
12
|
|
|
13
13
|
export default function processTailwindFeatures(setupContext) {
|
|
14
14
|
return function (root, result) {
|
|
15
|
-
let tailwindDirectives = normalizeTailwindDirectives(root)
|
|
15
|
+
let { tailwindDirectives, applyDirectives } = normalizeTailwindDirectives(root)
|
|
16
16
|
|
|
17
17
|
let context = setupContext({
|
|
18
18
|
tailwindDirectives,
|
|
19
|
+
applyDirectives,
|
|
19
20
|
registerDependency(dependency) {
|
|
20
21
|
result.messages.push({
|
|
21
22
|
plugin: 'tailwindcss',
|