|
| 1 | +import { symlinkSync } from 'fs'; |
| 2 | +import { resolve } from 'path'; |
| 3 | +import { expectFileToMatch, writeMultipleFiles } from '../../../utils/fs'; |
| 4 | +import { ng } from '../../../utils/process'; |
| 5 | +import { updateJsonFile } from '../../../utils/project'; |
| 6 | + |
| 7 | +export default async function () { |
| 8 | + await writeMultipleFiles({ |
| 9 | + 'src/styles.scss': `p { color: red }`, |
| 10 | + 'src/styles-for-link.scss': `p { color: blue }`, |
| 11 | + }); |
| 12 | + |
| 13 | + symlinkSync( |
| 14 | + resolve('src/styles-for-link.scss'), |
| 15 | + resolve('src/styles-linked.scss'), |
| 16 | + 'junction', |
| 17 | + ); |
| 18 | + |
| 19 | + await updateJsonFile('angular.json', workspaceJson => { |
| 20 | + const appArchitect = workspaceJson.projects['test-project'].architect; |
| 21 | + appArchitect.build.options.styles = [ |
| 22 | + 'src/styles.scss', |
| 23 | + 'src/styles-linked.scss', |
| 24 | + ]; |
| 25 | + }); |
| 26 | + |
| 27 | + await ng('build'); |
| 28 | + await expectFileToMatch('dist/test-project/styles.css', 'red'); |
| 29 | + await expectFileToMatch('dist/test-project/styles.css', 'blue'); |
| 30 | + |
| 31 | + await ng('build', '--preserve-symlinks'); |
| 32 | + await expectFileToMatch('dist/test-project/styles.css', 'red'); |
| 33 | + await expectFileToMatch('dist/test-project/styles.css', 'blue'); |
| 34 | +} |
0 commit comments