forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstylus.ts
More file actions
42 lines (41 loc) · 1.49 KB
/
stylus.ts
File metadata and controls
42 lines (41 loc) · 1.49 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
33
34
35
36
37
38
39
40
41
42
import {
writeMultipleFiles,
deleteFile,
expectFileToMatch,
replaceInFile
} from '../../../utils/fs';
import { expectToFail } from '../../../utils/utils';
import { ng } from '../../../utils/process';
import { stripIndents } from 'common-tags';
import { updateJsonFile } from '../../../utils/project';
export default function () {
return writeMultipleFiles({
'src/styles.styl': stripIndents`
@import './imported-styles.styl';
body { background-color: blue; }
`,
'src/imported-styles.styl': stripIndents`
p { background-color: red; }
`,
'src/app/app.component.styl': stripIndents`
.outer {
.inner {
background: #fff;
}
}
`})
.then(() => deleteFile('src/app/app.component.css'))
.then(() => updateJsonFile('angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['styles'] = ['styles.styl'];
}))
.then(() => replaceInFile('src/app/app.component.ts',
'./app.component.css', './app.component.styl'))
.then(() => ng('build', '--extract-css', '--sourcemap'))
.then(() => expectFileToMatch('dist/styles.bundle.css',
/body\s*{\s*background-color: #00f;\s*}/))
.then(() => expectFileToMatch('dist/styles.bundle.css',
/p\s*{\s*background-color: #f00;\s*}/))
.then(() => expectToFail(() => expectFileToMatch('dist/styles.bundle.css', '"mappings":""')))
.then(() => expectFileToMatch('dist/main.bundle.js', /.outer.*.inner.*background:\s*#[fF]+/));
}