@@ -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,31 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
83
84
}
84
85
85
86
var cwd = process . cwd ( ) ;
87
+ var translate = loader . translate ;
88
+
89
+ loader . translate = function ( load ) {
90
+ return translate . call ( this , load ) . then ( function ( ) {
91
+ if ( load . metadata . style ) {
92
+ inputFiles [ path . relative ( baseURLPath , fromFileURL ( load . address ) ) ] = {
93
+ source : load . metadata . style ,
94
+ sourceMap : load . metadata . styleSourceMap
95
+ } ;
96
+ load . metadata . format = 'amd' ;
97
+ }
98
+ } ) ;
99
+ } ;
86
100
87
101
var postCssPlugins = [ atImport ( {
88
102
resolve : function ( fileName , dirname , opts ) {
89
- if ( absUrl ( fileName ) )
90
- return fileName ;
91
- return path . relative ( baseURLPath , path . join ( dirname , fileName ) ) ;
103
+ var resolved = fileName ;
104
+ if ( ! absUrl ( fileName ) ) {
105
+ fileName = path . join ( dirname , fileName ) ;
106
+ resolved = path . relative ( baseURLPath , fileName ) ;
107
+ }
108
+
109
+ return loader . import ( fileName , module . id ) . then ( function ( ) {
110
+ return resolved ;
111
+ } ) ;
92
112
} ,
93
113
load : function ( fileName , opts ) {
94
114
if ( absUrl ( fileName ) )
@@ -157,6 +177,7 @@ exports.bundle = function(loads, compileOpts, outputOpts) {
157
177
} )
158
178
. then ( function ( result ) {
159
179
var cssOutput = result . css ;
180
+ loader . translate = translate ;
160
181
161
182
// write a separate CSS file if necessary
162
183
if ( loader . separateCSS ) {
0 commit comments