Sha256: 9ebffd0df65a843485b42de10e985c8a87404fe79077a5a39541c40fae9c23cb

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

//Load the requirejs optimizer
var requirejs = require('<%= rjs_path %>'),
  //Set up basic config, include config that is
  //common to all the optimize() calls.
  basConfig = <%= JSON.pretty_generate(build_config.reject {|k,v| k == 'modules'}) %>;

// Function used to mix in baseConfig to a new config target
function mix(target) {
  for (var prop in basConfig) {
    if (basConfig.hasOwnProperty(prop)) {
      target[prop] = basConfig[prop];
    }
  }
  return target;
}

var module_specs = [
<% build_config['modules'].each do |m| %>
<%= JSON.pretty_generate(m.merge 'out' => module_path_for(m).to_s ) %>,
<% end %>
];

// Do a series of builds of individual files, using the args suggested by:
// http://requirejs.org/docs/optimization.html#onejs
//
// r.js will eventually need a nested call idiom to handle async 
// builds.  Anticipating that need.
var async_runner = module_specs.reduceRight(function(prev, curr) {
  return function (buildReportText) { 
    requirejs.optimize(mix(curr), prev);
  };
}, function(buildReportText) {} );

async_runner();

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
requirejs-rails-0.9.1 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.9.0 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.8.2 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.8.0 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.7.3 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.7.2 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.7.1 lib/requirejs/rails/rjs_driver.js.erb
requirejs-rails-0.7.0 lib/requirejs/rails/rjs_driver.js.erb