fix(vue): tailwind generator ignoring styleSheet option (#21840)

This commit is contained in:
Julian Martin 2024-02-19 09:04:45 +01:00 committed by GitHub
parent 5b6d1b4017
commit 31348e2b85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -24,6 +24,10 @@ export function addTailwindStyleImports(
project: ProjectConfiguration,
_options: SetupTailwindOptions
) {
if (_options.stylesheet) {
knownStylesheetLocations.push(_options.stylesheet);
}
const stylesPath = knownStylesheetLocations
.map((file) => joinPathFragments(project.root, file))
.find((file) => tree.exists(file));

View File

@ -42,6 +42,30 @@ describe('vue setup-tailwind generator', () => {
);
});
it('should update existing stylesheet passed with option', async () => {
const tree = createTreeWithEmptyWorkspace();
addProjectConfiguration(tree, 'example', {
root: 'example',
sourceRoot: 'example/src',
targets: {},
});
tree.write(`example/src/style.css`, `/* existing content */`);
await update(tree, {
project: 'example',
stylesheet: 'src/style.css',
});
expect(tree.read(`example/src/style.css`).toString()).toContain(
stripIndents`
@tailwind base;
@tailwind components;
@tailwind utilities;
/* existing content */
`
);
});
it('should install packages', async () => {
const tree = createTreeWithEmptyWorkspace();
addProjectConfiguration(tree, 'example', {