File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module.exports = function(options) {
6
6
7
7
var import_paths
8
8
, import_paths_len ;
9
-
9
+
10
10
return function ( url , prev , done ) {
11
11
if ( url . slice ( 0 , 4 ) !== 'CSS:' ) {
12
12
return done ( ) ;
@@ -30,11 +30,14 @@ module.exports = function(options) {
30
30
css_filepath = path . join ( import_path , css_path ) ;
31
31
if ( fs . existsSync ( css_filepath ) ) {
32
32
fs . readFile ( css_filepath , function ( err , data ) {
33
- if ( err ) return console . error ( err ) ;
33
+ if ( err ) {
34
+ return done ( err ) ;
35
+ }
34
36
done ( { contents : data . toString ( ) } ) ;
35
37
} ) ;
36
- break ;
38
+ return ;
37
39
}
38
40
}
41
+ return done ( new Error ( 'Specified CSS file not found! ("' + css_path + '" referenced from "' + prev + '")' ) ) ;
39
42
} ;
40
43
} ;
Original file line number Diff line number Diff line change
1
+ html {
2
+ font-size : 10px ;
3
+ }
4
+
5
+ @import " CSS:doesntexist" ;
Original file line number Diff line number Diff line change @@ -26,3 +26,11 @@ node.render({
26
26
assert . equal ( actual . css . toString ( ) , expected . toString ( ) ) ;
27
27
} ) ;
28
28
} ) ;
29
+
30
+ node . render ( {
31
+ file : path . join ( __dirname , 'badsource.scss' ) ,
32
+ importer : cssImporter ( { import_paths : [ __dirname ] } )
33
+ } , function ( err , actual ) {
34
+ assert . notEqual ( err , null ) ;
35
+ assert . equal ( err . message . slice ( 0 , 29 ) , 'Specified CSS file not found!' ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments