forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss.ts
More file actions
32 lines (31 loc) · 1.07 KB
/
css.ts
File metadata and controls
32 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {
writeMultipleFiles,
expectFileToMatch,
} from '../../../utils/fs';
import { expectToFail } from '../../../utils/utils';
import { ng } from '../../../utils/process';
import { stripIndents } from 'common-tags';
export default function () {
return writeMultipleFiles({
'src/styles.css': stripIndents`
@import './imported-styles.css';
body { background-color: blue; }
`,
'src/imported-styles.css': stripIndents`
p { background-color: red; }
`,
'src/app/app.component.css': stripIndents`
.outer {
.inner {
background: #fff;
}
}
`})
.then(() => ng('build', '--extract-css', '--sourcemap'))
.then(() => expectFileToMatch('dist/styles.bundle.css',
/body\s*{\s*background-color: blue;\s*}/))
.then(() => expectFileToMatch('dist/styles.bundle.css',
/p\s*{\s*background-color: red;\s*}/))
.then(() => expectToFail(() => expectFileToMatch('dist/styles.bundle.css', '"mappings":""')))
.then(() => expectFileToMatch('dist/main.bundle.js', /.outer.*.inner.*background:\s*#[fF]+/));
}