@@ -5,42 +5,16 @@ var requirejs = require('<%= rjs_path %>'),
55 baseConfig = < %=
66 modifiedHash = build_config . select { | k , _ | k ! = "modules" }
77 pathsHash = modifiedHash [ "paths" ]
8+ modifiedHash [ "dir" ] = self . target_dir
89 modifiedHash [ "paths" ] = pathsHash . select { | _ , v | ! v . is_a ?( Array ) } if ! pathsHash . nil ?
910
1011 JSON . pretty_generate ( modifiedHash )
1112 % > ;
1213
13- // Function used to mix in baseConfig to a new config target
14- function mix ( target ) {
15- for ( var prop in baseConfig ) {
16- if ( baseConfig . hasOwnProperty ( prop ) ) {
17- target [ prop ] = baseConfig [ prop ] ;
18- }
19- }
20- return target ;
21- }
22-
23- var module_specs = [
14+ baseConfig . modules = [
2415< % build_config [ 'modules' ] . each do | m | % >
25- < %= JSON . pretty_generate ( m . merge 'out' = > module_path_for ( m ) . to_s ) % > ,
16+ < %= JSON . pretty_generate ( m ) % > ,
2617< % end % >
2718] ;
2819
29- // Error handler invoked in case requirejs compilation fails
30- var errback = function ( error ) {
31- process . stderr . write ( error . toString ( ) ) ;
32- process . exit ( 1 ) ;
33- }
34-
35- // Do a series of builds of individual files, using the args suggested by:
36- // http://requirejs.org/docs/optimization.html#onejs
37- //
38- // r.js will eventually need a nested call idiom to handle async
39- // builds. Anticipating that need.
40- var async_runner = module_specs . reduceRight ( function ( prev , curr ) {
41- return function ( buildReportText ) {
42- requirejs . optimize ( mix ( curr ) , prev , errback ) ;
43- } ;
44- } , function ( buildReportText ) { } ) ;
45-
46- async_runner ( ) ;
20+ requirejs . optimize ( baseConfig ) ;
0 commit comments