File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed
packages/angular_devkit/build_angular/src/sass
tests/legacy-cli/e2e/tests/build/styles Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,10 @@ abstract class UrlRebasingImporter implements Importer<'sync'> {
89
89
90
90
let syntax : Syntax | undefined ;
91
91
switch ( extname ( stylesheetPath ) . toLowerCase ( ) ) {
92
- case 'css' :
92
+ case '. css' :
93
93
syntax = 'css' ;
94
94
break ;
95
- case 'sass' :
95
+ case '. sass' :
96
96
syntax = 'indented' ;
97
97
break ;
98
98
default :
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 { expectToFail } from '../../../utils/utils' ;
8
+ import { ng } from '../../../utils/process' ;
9
+ import { updateJsonFile } from '../../../utils/project' ;
10
+
11
+ export default async function ( ) {
12
+ await writeMultipleFiles ( {
13
+ 'src/styles.sass' : `
14
+ @import './imported-styles.sass'
15
+ body
16
+ background-color: blue
17
+ ` ,
18
+ 'src/imported-styles.sass' : `
19
+ p
20
+ background-color: red
21
+ ` ,
22
+ 'src/app/app.component.sass' : `
23
+ .outer
24
+ .inner
25
+ background: #fff
26
+ ` ,
27
+ } ) ;
28
+
29
+ await updateJsonFile ( 'angular.json' , ( workspaceJson ) => {
30
+ const appArchitect = workspaceJson . projects [ 'test-project' ] . architect ;
31
+ appArchitect . build . options . styles = [ { input : 'src/styles.sass' } ] ;
32
+ } ) ;
33
+
34
+ await deleteFile ( 'src/app/app.component.css' ) ;
35
+ await replaceInFile ( 'src/app/app.component.ts' , './app.component.css' , './app.component.sass' ) ;
36
+
37
+ await ng ( 'build' , '--source-map' , '--configuration=development' ) ;
38
+
39
+ await expectFileToMatch ( 'dist/test-project/styles.css' , / b o d y \s * { \s * b a c k g r o u n d - c o l o r : b l u e ; \s * } / ) ;
40
+ await expectFileToMatch ( 'dist/test-project/styles.css' , / p \s * { \s * b a c k g r o u n d - c o l o r : r e d ; \s * } / ) ;
41
+ await expectToFail ( ( ) => expectFileToMatch ( 'dist/test-project/styles.css' , '"mappings":""' ) ) ;
42
+ await expectFileToMatch ( 'dist/test-project/main.js' , / .o u t e r .* .i n n e r .* b a c k g r o u n d : \s * # [ f F ] + / ) ;
43
+ }
You can’t perform that action at this time.
0 commit comments