@@ -15,6 +15,7 @@ var PLUGIN_NAME = 'gulp-sass';
15
15
var gulpSass = function gulpSass ( options , sync ) {
16
16
return through . obj ( function ( file , enc , cb ) {
17
17
var opts ,
18
+ ip ,
18
19
filePush ,
19
20
errorM ,
20
21
callback ,
@@ -31,7 +32,20 @@ var gulpSass = function gulpSass(options, sync) {
31
32
}
32
33
33
34
opts = assign ( { } , options ) ;
34
- opts . file = file . path ;
35
+ opts . data = file . contents . toString ( ) ;
36
+
37
+ if ( opts . includePaths ) {
38
+ if ( typeof opts . includePaths === 'string' ) {
39
+ ip = opts . includePaths ;
40
+ opts . includePaths = [ ] ;
41
+ opts . includePaths . push ( ip ) ;
42
+ }
43
+ }
44
+ else {
45
+ opts . includePaths = [ ] ;
46
+ }
47
+
48
+ opts . includePaths . push ( path . dirname ( file . path ) ) ;
35
49
36
50
// Generate Source Maps if plugin source-map present
37
51
if ( file . sourceMap ) {
@@ -58,9 +72,13 @@ var gulpSass = function gulpSass(options, sync) {
58
72
// Handles error message
59
73
//////////////////////////////
60
74
errorM = function errorM ( error ) {
61
- var relativePath = path . relative ( process . cwd ( ) , error . file ) ,
75
+ var relativePath = '' ,
76
+ filePath = error . file === 'stdin' ? file . path : error . file ,
62
77
message = '' ;
63
78
79
+ filePath = filePath ? filePath : file . path ;
80
+ relativePath = path . relative ( process . cwd ( ) , filePath ) ;
81
+
64
82
message += gutil . colors . underline ( relativePath ) + '\n' ;
65
83
message += gutil . colors . gray ( ' ' + error . line + ':' + error . column ) + ' ' ;
66
84
message += error . message ;
0 commit comments