fix(vue): tailwind generator ignoring styleSheet option (#21840)
This commit is contained in:
parent
5b6d1b4017
commit
31348e2b85
@ -24,6 +24,10 @@ export function addTailwindStyleImports(
|
|||||||
project: ProjectConfiguration,
|
project: ProjectConfiguration,
|
||||||
_options: SetupTailwindOptions
|
_options: SetupTailwindOptions
|
||||||
) {
|
) {
|
||||||
|
if (_options.stylesheet) {
|
||||||
|
knownStylesheetLocations.push(_options.stylesheet);
|
||||||
|
}
|
||||||
|
|
||||||
const stylesPath = knownStylesheetLocations
|
const stylesPath = knownStylesheetLocations
|
||||||
.map((file) => joinPathFragments(project.root, file))
|
.map((file) => joinPathFragments(project.root, file))
|
||||||
.find((file) => tree.exists(file));
|
.find((file) => tree.exists(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 () => {
|
it('should install packages', async () => {
|
||||||
const tree = createTreeWithEmptyWorkspace();
|
const tree = createTreeWithEmptyWorkspace();
|
||||||
addProjectConfiguration(tree, 'example', {
|
addProjectConfiguration(tree, 'example', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user