File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ module.exports = grunt => {
13
13
'test/tmp/compile2.css' : 'test/fixtures/test.scss'
14
14
}
15
15
} ,
16
+ modernCompile : {
17
+ options : {
18
+ api : 'modern'
19
+ } ,
20
+ files : {
21
+ 'test/tmp/modern-compile.css' : 'test/fixtures/test.scss' ,
22
+ 'test/tmp/modern-compile2.css' : 'test/fixtures/test.scss'
23
+ }
24
+ } ,
16
25
includePaths : {
17
26
options : {
18
27
includePaths : [ 'test/fixtures' ]
Original file line number Diff line number Diff line change @@ -19,15 +19,20 @@ module.exports = grunt => {
19
19
( async ( ) => {
20
20
await Promise . all ( this . files . map ( async item => {
21
21
const [ src ] = item . src ;
22
+ let result ;
22
23
23
24
if ( ! src || path . basename ( src ) [ 0 ] === '_' ) {
24
25
return ;
25
26
}
26
27
27
- const result = await util . promisify ( options . implementation . render ) ( Object . assign ( { } , options , {
28
- file : src ,
29
- outFile : item . dest
30
- } ) ) ;
28
+ if ( options . api === 'modern' ) {
29
+ result = await options . implementation . compileAsync ( src , options ) ;
30
+ } else {
31
+ result = await util . promisify ( options . implementation . render ) ( Object . assign ( { } , options , {
32
+ file : src ,
33
+ outFile : item . dest
34
+ } ) ) ;
35
+ }
31
36
32
37
grunt . file . write ( item . dest , result . css ) ;
33
38
Original file line number Diff line number Diff line change @@ -13,6 +13,17 @@ exports.sass = {
13
13
14
14
test . done ( ) ;
15
15
} ,
16
+ modernCompile ( test ) {
17
+ test . expect ( 2 ) ;
18
+
19
+ const actual = grunt . file . read ( 'test/tmp/modern-compile.css' ) ;
20
+ const actual2 = grunt . file . read ( 'test/tmp/modern-compile2.css' ) ;
21
+ const expected = grunt . file . read ( 'test/expected/compile.css' ) ;
22
+ test . equal ( actual , expected , 'should compile SCSS to CSS' ) ;
23
+ test . equal ( actual2 , expected , 'should compile SCSS to CSS' ) ;
24
+
25
+ test . done ( ) ;
26
+ } ,
16
27
includePaths ( test ) {
17
28
test . expect ( 1 ) ;
18
29
You can’t perform that action at this time.
0 commit comments