1
- import { ng } from '../../../utils/process' ;
1
+ import { ng , silentNpm } from '../../../utils/process' ;
2
2
import {
3
3
expectFileToMatch ,
4
4
expectFileToExist ,
7
7
} from '../../../utils/fs' ;
8
8
import { copyProjectAsset } from '../../../utils/assets' ;
9
9
import { expectToFail } from '../../../utils/utils' ;
10
+ import { updateJsonFile } from '../../../utils/project' ;
10
11
11
12
const imgSvg = `
12
13
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
@@ -16,8 +17,11 @@ const imgSvg = `
16
17
17
18
export default function ( ) {
18
19
return Promise . resolve ( )
20
+ . then ( ( ) => silentNpm ( 'install' , '[email protected] ' ) )
19
21
. then ( ( ) => writeMultipleFiles ( {
20
- 'src/styles.css' : `
22
+ 'src/styles.scss' : `
23
+ $fa-font-path: "~font-awesome/font";
24
+ @import "~font-awesome/scss/font-awesome";
21
25
h1 { background: url('./assets/large.png'); }
22
26
h2 { background: url('./assets/small.svg'); }
23
27
p { background: url('./assets/small-id.svg#testID'); }
@@ -30,7 +34,16 @@ export default function () {
30
34
'src/assets/small-id.svg' : imgSvg
31
35
} ) )
32
36
. then ( ( ) => copyProjectAsset ( 'images/spectrum.png' , './assets/large.png' ) )
37
+ . then ( ( ) => updateJsonFile ( '.angular-cli.json' , configJson => {
38
+ const app = configJson [ 'apps' ] [ 0 ] ;
39
+ app [ 'styles' ] = [ 'styles.scss' ] ;
40
+ } ) )
33
41
. then ( ( ) => ng ( 'build' , '--extract-css' , '--aot' ) )
42
+ . then ( ( { stdout } ) => {
43
+ if ( stdout . match ( / p o s t c s s - u r l : \. + : C a n ' t r e a d f i l e ' \. + ' , i g n o r i n g / ) ) {
44
+ throw new Error ( 'Expected no postcss-url file read warnings.' ) ;
45
+ }
46
+ } )
34
47
// Check paths are correctly generated.
35
48
. then ( ( ) => expectFileToMatch ( 'dist/styles.bundle.css' ,
36
49
/ u r l \( [ \' " ] ? l a r g e \. [ 0 - 9 a - f ] { 20 } \. p n g [ \' " ] ? \) / ) )
0 commit comments