@@ -198,21 +198,14 @@ const EMBER_ADDON: AddonImplementation<CSSBlocksApplicationAddon> = {
198
198
let env = this . env ! ;
199
199
200
200
if ( type === "css" ) {
201
- if ( ! env . isApp || env . config . broccoliConcat === "SKIP" ) {
201
+ if ( ! env . isApp || env . config . broccoliConcat === false ) {
202
202
return tree ;
203
203
}
204
204
205
- // Merge default concat options with the options provided by the app.
206
- let concatOptions : BroccoliConcatOptions = Object . assign (
207
- { } ,
208
- buildDefaultBroccoliConcatOptions ( env ) ,
209
- env . config . broccoliConcat || { } ,
210
- ) ;
211
-
212
205
// Create the concatenated file...
213
206
const concatTree = broccoliConcat (
214
207
tree ,
215
- concatOptions ,
208
+ buildBroccoliConcatOptions ( env ) ,
216
209
) ;
217
210
218
211
// Then overwrite the original file with our final build artifact.
@@ -224,19 +217,55 @@ const EMBER_ADDON: AddonImplementation<CSSBlocksApplicationAddon> = {
224
217
} ,
225
218
} ;
226
219
220
+ /**
221
+ * Merge together default and user-provided config options to build the
222
+ * configuration for broccoli-concat.
223
+ * @param env - The current addon environment. Includes override configs.
224
+ * @returns - Merged broccoli concat settings.
225
+ */
226
+ function buildBroccoliConcatOptions ( env : AddonEnvironment ) : BroccoliConcatOptions {
227
+ const overrides = env . config . broccoliConcat || { } ;
228
+ // The sourcemap config requires special handling because
229
+ // things break if extensions or mapCommentType is incorrect.
230
+ // We force these to use specific values, but defer to the
231
+ // provided options for all other properties.
232
+ let sourceMapConfig ;
233
+ sourceMapConfig = Object . assign (
234
+ { } ,
235
+ {
236
+ enabled : true ,
237
+ } ,
238
+ overrides . sourceMapConfig ,
239
+ {
240
+ extensions : [ "css" ] ,
241
+ mapCommentType : "block" ,
242
+ } ,
243
+ ) ;
244
+ // Merge, preferring the user provided options, except for
245
+ // the sourceMapConfig, which we merged above.
246
+ return Object . assign (
247
+ { } ,
248
+ buildDefaultBroccoliConcatOptions ( env ) ,
249
+ env . config . broccoliConcat ,
250
+ {
251
+ sourceMapConfig,
252
+ } ,
253
+ ) ;
254
+ }
255
+
227
256
/**
228
257
* Build a default broccoli-concat config, using given enviroment settings.
229
258
* @param env - The addon environment.
230
259
* @returns - Default broccoli-concat options, accounting for current env settings.
231
260
*/
232
261
function buildDefaultBroccoliConcatOptions ( env : AddonEnvironment ) : BroccoliConcatOptions {
262
+ const cssBlocksOutputFilename = env . config . output || "css-blocks.css" ;
233
263
return {
234
- inputFiles : [ " assets/css-blocks.css" , `assets/${ env . modulePrefix } .css` ] ,
264
+ inputFiles : [ ` assets/${ cssBlocksOutputFilename } ` , `assets/${ env . modulePrefix } .css` ] ,
235
265
outputFile : `assets/${ env . modulePrefix } .css` ,
236
266
sourceMapConfig : {
237
267
enabled : true ,
238
268
extensions : [ "css" ] ,
239
- inline : true ,
240
269
mapCommentType : "block" ,
241
270
} ,
242
271
} ;
0 commit comments