1- import { ng } from '../../../utils/process' ;
1+ import { ng , silentNpm } from '../../../utils/process' ;
22import {
33 expectFileToMatch ,
44 expectFileToExist ,
77} from '../../../utils/fs' ;
88import { copyProjectAsset } from '../../../utils/assets' ;
99import { expectToFail } from '../../../utils/utils' ;
10+ import { updateJsonFile } from '../../../utils/project' ;
1011
1112const imgSvg = `
1213 <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
@@ -16,8 +17,11 @@ const imgSvg = `
1617
1718export default function ( ) {
1819 return Promise . resolve ( )
20+ . then ( ( ) => silentNpm ( 'install' , 'font-awesome@4.7.0' ) )
1921 . then ( ( ) => writeMultipleFiles ( {
20- 'src/styles.css' : `
22+ 'src/styles.scss' : `
23+ $fa-font-path: "~font-awesome/font";
24+ @import "~font-awesome/scss/font-awesome";
2125 h1 { background: url('./assets/large.png'); }
2226 h2 { background: url('./assets/small.svg'); }
2327 p { background: url('./assets/small-id.svg#testID'); }
@@ -30,7 +34,16 @@ export default function () {
3034 'src/assets/small-id.svg' : imgSvg
3135 } ) )
3236 . 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+ } ) )
3341 . 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+ } )
3447 // Check paths are correctly generated.
3548 . then ( ( ) => expectFileToMatch ( 'dist/styles.bundle.css' ,
3649 / u r l \( [ \' " ] ? l a r g e \. [ 0 - 9 a - f ] { 20 } \. p n g [ \' " ] ? \) / ) )
0 commit comments