Skip to main content

Questions tagged [requirejs]

RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node.js. If you are using the require call that comes bundled with Node.js then you are NOT using RequireJS. Please do not use this tag for such cases. Use the require tag instead.

0 votes
1 answer
505 views

How could RequireJS be used with a system like Joomla?

This is a theoretical question. How would RequireJS be used with a system like Joomla with the directory structure (including ability to include scripts from components, plugins, etc) /components/...
Lea Hayes's user avatar
  • 63.7k
9 votes
3 answers
4k views

Passing bootstrapped variables and JSON to require.js

What is the best practice for passing bootstrapped variables within the rendered page (i.e. JSON data or config variables) to require.js so they can be checked for an used by dependancies? It looks ...
dlrust's user avatar
  • 2,473
5 votes
1 answer
5k views

Alternatives to YepNope and LabJS [closed]

I am wanting to load javascript and css files via a resource loader. I was originally using LabJs but I found YepNope more elegant and easier to work with in my scenario. However I am finding it ...
Grofit's user avatar
  • 18.2k
3 votes
1 answer
735 views

RequireJs build script failing to locate jQuery

I'm successfully loading jQuery (when setting require.config)... // For details see: // http://groups.google.com/group/requirejs/browse_thread/thread/e7532b7e3013bc62/1e5ca8a89b276de6?show_docid=...
Integralist's user avatar
  • 2,201
25 votes
1 answer
8k views

Using RequireJS with a Rails 3.1 app

Question If you've used RequireJS with a Rails 3 (esp 3.1) app, how is that working for you? Any configuration tricks or other gotchas that I need to watch out for? Background I'm contemplating ...
John Whitley's user avatar
  • 2,055
72 votes
2 answers
50k views

RequireJS: Loading modules including templates and CSS [closed]

After playing around with AMD/RequireJS I was wondering if it is a good idea to load UI modules including templates and CSS so they are completely independent from the web page. It sounds like good, ...
fbrandel's user avatar
  • 1,605
2 votes
2 answers
3k views

What's wrong with my RequireJS dependency chain?

I'm just getting started with RequireJS and it appears I'm not expressing my dependencies correctly. I'm trying to map a fairly straightforward dependency chain: KnockoutJS depends on jquery-tmpl ...
Ragesh's user avatar
  • 3,003
5 votes
1 answer
2k views

RequireJS: Can two modules require each other?

Is the following possible with RequireJS? Module A: define([ 'moduleB' ], function(moduleB){ // log moduleB exports console.log(moduleB); // exports var moduleA = {}; // set a var to ...
wilsonpage's user avatar
  • 17.5k
9 votes
2 answers
1k views

How does AMD (specifically RequireJs) handle dependancies across multiple modules

I have my main initialization script which calls require() and one of the dependencies is a utilities framework, but some of the other modules that I'm specifying via require() also themselves have ...
Integralist's user avatar
  • 2,201
2 votes
2 answers
3k views

backbone.js - loading .js files when needed with require.js

I found interesting link on how to organize my files and load files using require.js http://backbonetutorials.com/organizing-backbone-using-modules/ , the only issue I have with that example is that ...
kaha's user avatar
  • 1,417
19 votes
1 answer
6k views

With AMD modules, when (or why) is it OK to use require() within define()?

My understanding of AMD modules (using for example RequireJs or curl.js) is: require() is used to asynchronously load different modules and when loaded then the callback fn is executed. And to ...
Integralist's user avatar
  • 2,201
1 vote
1 answer
780 views

Require.js optimizer via msbuild doesn't work, but directly on command line does

in my code, the following command, executed on a powershell prompt r.js -o name=main out=main_opt.js baseUrl=. works fine and outputs the following Tracing dependencies for: main Uglifying file: C:/...
Scott Weinstein's user avatar
6 votes
2 answers
1k views

BackboneJS site structure

Ok I am trying to get my head round this whole backboneJS thing. I understand you have to separate your site into modules and break each module down into Models, Collections and Views like described ...
wilsonpage's user avatar
  • 17.5k
35 votes
8 answers
45k views

Using the Backbone.js router to navigate through views modularized with require.js

I am separating my views and router into separate files with require. I then have a main.js file that instantiates the router, and also renders my default view. My router has view ('View/:id') and ...
MrGrigg's user avatar
  • 1,732
35 votes
3 answers
21k views

Dependency Injection with RequireJS

How much can I stretch RequireJS to provide dependency injection for my app? As an example, let's say I have a model that I want to be a singleton. Not a singleton in a self-enforcing getInstance()-...
Aaronius's user avatar
  • 4,933

15 30 50 per page
1
510 511
512
513 514
516