diff --git a/packages/vue/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts b/packages/vue/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts index 972b3439e1301..92e7e76840a9e 100644 --- a/packages/vue/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts +++ b/packages/vue/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts @@ -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)); diff --git a/packages/vue/src/generators/setup-tailwind/setup-tailwind.spec.ts b/packages/vue/src/generators/setup-tailwind/setup-tailwind.spec.ts index ab28d8d58303d..5278d3758532f 100644 --- a/packages/vue/src/generators/setup-tailwind/setup-tailwind.spec.ts +++ b/packages/vue/src/generators/setup-tailwind/setup-tailwind.spec.ts @@ -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', {