@@ -70,6 +70,7 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
70
70
71
71
var inputFiles = { } ;
72
72
cssLoads . forEach ( function ( load ) {
73
+ loader . builder = load . metadata . builder ;
73
74
inputFiles [ path . relative ( baseURLPath , fromFileURL ( load . address ) ) ] = {
74
75
source : load . metadata . style ,
75
76
sourceMap : load . metadata . styleSourceMap
@@ -83,12 +84,35 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
83
84
}
84
85
85
86
var cwd = process . cwd ( ) ;
87
+ var translate = loader . translate ;
88
+ var instantiate = loader . instantiate ;
89
+
90
+ loader . translate = function ( load ) {
91
+ return translate . call ( this , load ) . then ( function ( ) {
92
+ if ( load . metadata . style ) {
93
+ inputFiles [ path . relative ( baseURLPath , fromFileURL ( load . address ) ) ] = {
94
+ source : load . metadata . style ,
95
+ sourceMap : load . metadata . styleSourceMap
96
+ } ;
97
+ }
98
+ } ) ;
99
+ } ;
100
+
101
+ loader . instantiate = function ( load ) { } ;
86
102
87
103
var postCssPlugins = [ atImport ( {
88
104
resolve : function ( fileName , dirname , opts ) {
89
- if ( absUrl ( fileName ) )
90
- return fileName ;
91
- return path . relative ( baseURLPath , path . join ( dirname , fileName ) ) ;
105
+ var resolved = fileName ;
106
+ if ( ! absUrl ( fileName ) ) {
107
+ fileName = path . join ( dirname , fileName ) ;
108
+ resolved = path . relative ( baseURLPath , fileName ) ;
109
+ }
110
+
111
+ return loader . import ( fileName , module . id ) . then ( function ( ) {
112
+ return resolved ;
113
+ } , function ( err ) {
114
+ return resolved ;
115
+ } ) ;
92
116
} ,
93
117
load : function ( fileName , opts ) {
94
118
if ( absUrl ( fileName ) )
@@ -157,6 +181,8 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
157
181
} )
158
182
. then ( function ( result ) {
159
183
var cssOutput = result . css ;
184
+ loader . translate = translate ;
185
+ loader . instantiate = instantiate ;
160
186
161
187
// write a separate CSS file if necessary
162
188
if ( loader . separateCSS ) {
0 commit comments