forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.ts
More file actions
25 lines (24 loc) · 967 Bytes
/
postcss.ts
File metadata and controls
25 lines (24 loc) · 967 Bytes
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
import * as glob from 'glob';
import { writeFile, expectFileToMatch } from '../../../utils/fs';
import { ng } from '../../../utils/process';
import { stripIndents } from 'common-tags';
export default function () {
return writeFile('src/styles.css', stripIndents`
/* normal-comment */
/*! important-comment */
div { flex: 1 }
`)
// uses autoprefixer plugin for all builds
.then(() => ng('build', '--extract-css'))
.then(() => expectFileToMatch('dist/styles.bundle.css', stripIndents`
/* normal-comment */
/*! important-comment */
div { -webkit-box-flex: 1; -ms-flex: 1; flex: 1 }
`))
// uses postcss-discard-comments plugin for prod
.then(() => ng('build', '--prod'))
.then(() => glob.sync('dist/styles.*.bundle.css').find(file => !!file))
.then((stylesBundle) => expectFileToMatch(stylesBundle, stripIndents`
/*! important-comment */div{-webkit-box-flex:1;-ms-flex:1;flex:1}
`));
}