-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathtailwind-v3-cjs.ts
More file actions
40 lines (32 loc) · 1.38 KB
/
tailwind-v3-cjs.ts
File metadata and controls
40 lines (32 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { expectFileToMatch, writeFile } from '../../../utils/fs';
import { installPackage, uninstallPackage } from '../../../utils/packages';
import { ng, silentExec } from '../../../utils/process';
import { updateJsonFile } from '../../../utils/project';
import { expectToFail } from '../../../utils/utils';
export default async function () {
// Temporarily turn off caching until the build cache accounts for the presence of tailwind
// and its configuration file. Otherwise cached builds without tailwind will cause test failures.
await ng('cache', 'off');
// Add type module in package.json.
await updateJsonFile('package.json', (json) => {
json['type'] = 'module';
});
// Install Tailwind
await installPackage('tailwindcss@3');
// Create configuration file
await silentExec('npx', 'tailwindcss', 'init');
// Add Tailwind directives to a global style
await writeFile('src/styles.css', '@tailwind base; @tailwind components;');
// Build should succeed and process Tailwind directives
await ng('build', '--configuration=development');
// Check for Tailwind output
await expectFileToMatch('dist/test-project/browser/styles.css', /::placeholder/);
await expectToFail(() =>
expectFileToMatch(
'dist/test-project/browser/styles.css',
/@tailwind base;\s+@tailwind components;/,
),
);
// Uninstall Tailwind
await uninstallPackage('tailwindcss');
}