File tree 2 files changed +41
-2
lines changed
packages/angular-cli/models
tests/e2e/tests/build/styles
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export function makeCssLoaders(stylePaths: string[] = []) {
67
67
{ test : / \. s t y l $ / , loaders : [ 'stylus-loader' ] }
68
68
] ;
69
69
70
- const commonLoaders = [ 'css-loader' , ' postcss-loader'] ;
70
+ const commonLoaders = [ 'postcss-loader' ] ;
71
71
72
72
// load component css as raw strings
73
73
let cssLoaders : any = baseRules . map ( ( { test, loaders} ) => ( {
@@ -78,7 +78,7 @@ export function makeCssLoaders(stylePaths: string[] = []) {
78
78
// load global css as css files
79
79
cssLoaders . push ( ...baseRules . map ( ( { test, loaders} ) => ( {
80
80
include : stylePaths , test, loaders : ExtractTextPlugin . extract ( {
81
- loader : [ ...commonLoaders , ...loaders ] ,
81
+ loader : [ 'css-loader' , ...commonLoaders , ...loaders ] ,
82
82
fallbackLoader : 'style-loader'
83
83
} )
84
84
} ) ) ) ;
Original file line number Diff line number Diff line change
1
+ import {
2
+ writeMultipleFiles ,
3
+ deleteFile ,
4
+ expectFileToMatch ,
5
+ replaceInFile
6
+ } from '../../../utils/fs' ;
7
+ import { ng } from '../../../utils/process' ;
8
+ import { stripIndents } from 'common-tags' ;
9
+ import { updateJsonFile } from '../../../utils/project' ;
10
+ import { expectToFail } from '../../../utils/utils' ;
11
+
12
+ export default function ( ) {
13
+ return writeMultipleFiles ( {
14
+ 'src/styles.scss' : stripIndents `
15
+ @import './imported-styles.scss';
16
+ body { background-color: blue; }
17
+ ` ,
18
+ 'src/imported-styles.scss' : stripIndents `
19
+ p { background-color: red; }
20
+ ` ,
21
+ 'src/app/app.component.scss' : stripIndents `
22
+ .outer {
23
+ .inner {
24
+ background: #fff;
25
+ }
26
+ }
27
+ ` } )
28
+ . then ( ( ) => deleteFile ( 'src/app/app.component.css' ) )
29
+ . then ( ( ) => updateJsonFile ( 'angular-cli.json' , configJson => {
30
+ const app = configJson [ 'apps' ] [ 0 ] ;
31
+ app [ 'styles' ] = [ 'styles.scss' ] ;
32
+ } ) )
33
+ . then ( ( ) => replaceInFile ( 'src/app/app.component.ts' ,
34
+ './app.component.css' , './app.component.scss' ) )
35
+ . then ( ( ) => ng ( 'build' ) )
36
+ . then ( ( ) => expectToFail ( ( ) => expectFileToMatch ( 'dist/styles.bundle.css' , / e x p o r t s / ) ) )
37
+ . then ( ( ) => expectToFail ( ( ) => expectFileToMatch ( 'dist/main.bundle.js' ,
38
+ / " .* m o d u l e \. e x p o r t s .* \. o u t e r .* b a c k g r o u n d : / ) ) ) ;
39
+ }
You can’t perform that action at this time.
0 commit comments