@@ -5,42 +5,16 @@ var requirejs = require('<%= rjs_path %>'),
5
5
baseConfig = < %=
6
6
modifiedHash = build_config . select { | k , _ | k ! = "modules" }
7
7
pathsHash = modifiedHash [ "paths" ]
8
+ modifiedHash [ "dir" ] = self . target_dir
8
9
modifiedHash [ "paths" ] = pathsHash . select { | _ , v | ! v . is_a ?( Array ) } if ! pathsHash . nil ?
9
10
10
11
JSON . pretty_generate ( modifiedHash )
11
12
% > ;
12
13
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 = [
24
15
< % build_config [ 'modules' ] . each do | m | % >
25
- < %= JSON . pretty_generate ( m . merge 'out' = > module_path_for ( m ) . to_s ) % > ,
16
+ < %= JSON . pretty_generate ( m ) % > ,
26
17
< % end % >
27
18
] ;
28
19
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