File tree 5 files changed +14
-9
lines changed
5 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ function createImportTransformerFromProgram(program: ts.Program) {
114
114
continue ;
115
115
}
116
116
}
117
+
117
118
newElements . push ( spec ) ;
118
119
}
119
120
Original file line number Diff line number Diff line change @@ -34,14 +34,17 @@ const transformer: Transformer<Options.Sass> = async ({
34
34
implementation = sass = mod . default ;
35
35
}
36
36
37
- const { renderSync, ...sassOptions } : Options . Sass = {
37
+ const { renderSync, prependData , ...restOptions } = {
38
38
sourceMap : true ,
39
39
...options ,
40
40
includePaths : getIncludePaths ( filename , options . includePaths ) ,
41
41
outFile : `${ filename } .css` ,
42
42
} ;
43
43
44
- sassOptions . data = options . data ? options . data + content : content ;
44
+ const sassOptions = {
45
+ ...restOptions ,
46
+ data : prependData ? prependData + content : content ,
47
+ } ;
45
48
46
49
// scss errors if passed an empty string
47
50
if ( sassOptions . data . length === 0 ) {
Original file line number Diff line number Diff line change @@ -26,12 +26,13 @@ export interface Babel extends BabelOptions {
26
26
}
27
27
28
28
export type Pug = PugOptions ;
29
- export type Sass = Omit < SassOptions , 'file' > & {
29
+ export type Sass = Omit < SassOptions , 'file' | 'data' > & {
30
30
implementation ?: {
31
31
render ?: typeof render ;
32
32
renderSync ?: typeof renderSync ;
33
33
} ;
34
34
renderSync ?: boolean ;
35
+ prependData ?: string ;
35
36
} ;
36
37
// from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/less/index.d.ts#L80
37
38
export interface Less {
Original file line number Diff line number Diff line change 1
- export type AType = " test1" | " test2"
1
+ export type AType = ' test1' | ' test2' ;
2
2
export interface AInterface {
3
- test : string
3
+ test : string ;
4
4
}
5
- export const AValue : string = " test"
5
+ export const AValue : string = ' test' ;
6
6
7
- export default " String"
7
+ export default ' String' ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ describe('transformer - scss', () => {
34
34
const template = `<style lang="scss"></style>` ;
35
35
const opts = getAutoPreprocess ( {
36
36
scss : {
37
- data : '$color:red;div{color:$color}' ,
37
+ prependData : '$color:red;div{color:$color}' ,
38
38
} ,
39
39
} ) ;
40
40
@@ -70,7 +70,7 @@ describe('transformer - scss', () => {
70
70
const template = `<style lang="scss"></style>` ;
71
71
const opts = getAutoPreprocess ( {
72
72
scss : {
73
- data : '$color:blue;div{color:$color}' ,
73
+ prependData : '$color:blue;div{color:$color}' ,
74
74
renderSync : true ,
75
75
} ,
76
76
} ) ;
You can’t perform that action at this time.
0 commit comments