|
| 1 | +import * as glob from 'glob'; |
| 2 | +import { writeMultipleFiles, expectFileToMatch } from '../../../utils/fs'; |
| 3 | +import { ng } from '../../../utils/process'; |
| 4 | +import { stripIndents } from 'common-tags'; |
| 5 | + |
| 6 | +export default function () { |
| 7 | + return writeMultipleFiles({ |
| 8 | + 'src/styles.css': stripIndents` |
| 9 | + div { background: url("./assets/more.svg"); } |
| 10 | + `, |
| 11 | + 'src/assets/more.svg': stripIndents` |
| 12 | + <svg width="100" height="100"> |
| 13 | + <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> |
| 14 | + </svg> |
| 15 | + `}) |
| 16 | + .then(() => ng('build')) |
| 17 | + .then(() => expectFileToMatch('dist/styles.bundle.css', |
| 18 | + /div\s*{\s*background:\s*url\(more.svg\);\s*}/)) |
| 19 | + .then(() => ng('build', '--prod')) |
| 20 | + .then(() => glob.sync('dist/styles.*.bundle.css').find(file => !!file)) |
| 21 | + .then((stylesBundle) => expectFileToMatch(stylesBundle, |
| 22 | + /div\s*{\s*background:\s*url\(more\..*svg\)\s*}/)) |
| 23 | + // build with deloyUrl |
| 24 | + .then(() => ng('build', '--deploy-url=client/')) |
| 25 | + .then(() => expectFileToMatch('dist/styles.bundle.css', |
| 26 | + /div\s*{\s*background:\s*url\(more.svg\);\s*}/)) |
| 27 | + .then(() => ng('build', '--prod', '--deploy-url=client/')) |
| 28 | + .then(() => glob.sync('dist/styles.*.bundle.css').find(file => !!file)) |
| 29 | + .then((stylesBundle) => expectFileToMatch(stylesBundle, |
| 30 | + /div\s*{\s*background:\s*url\(more\..*svg\)\s*}/)); |
| 31 | +} |
0 commit comments