Created
August 10, 2012 01:58
-
-
Save rricard/3310322 to your computer and use it in GitHub Desktop.
Path config fallback for RequireJS compilation error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Error: ENOENT, no such file or directory 'RAILS_ROOT/tmp/assets/http:/cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min,zepto.js' | |
at Object.fs.openSync (fs.js:338:18) | |
at build (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:14166:23) | |
at requirejs.optimize.runBuild (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15358:30) | |
at Object.context.execCb (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1773:33) | |
at Object.Module.check (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1083:51) | |
at Object.Module.enable (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1324:22) | |
at Object.Module.init (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:982:26) | |
at Object.context.require (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1579:28) | |
at requirejs (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:1857:24) | |
at Function.requirejs.optimize (/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js:15368:13) | |
at RAILS_ROOT/tmp/rjs_driver.js:48:15 | |
rake aborted! | |
Asset compilation with node failed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Load the requirejs optimizer | |
var requirejs = require('/usr/local/Cellar/rbenv/0.3.0/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/requirejs-rails-0.9.0/bin/r.js'), | |
//Set up basic config, include config that is | |
//common to all the optimize() calls. | |
basConfig = { | |
"baseUrl": "RAILS_ROOT/tmp/assets", | |
"paths": { | |
"zepto": "http://cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min", | |
"jquery": "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min" | |
} | |
}; | |
// 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 = [ | |
{ | |
"name": "almond", | |
"exclude": [ | |
"zepto", | |
"jquery" | |
], | |
"include": "application", | |
"out": "RAILS_ROOT/public/assets/application.js" | |
}, | |
]; | |
// 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment