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.

requirejs
1 vote
1 answer
1k views

jQuery as AMD module and optimizing with r.js

Allright, he is the thing. I am using curl.js for my AMD loader, but i don't like much of "cram" because it needs to be run on unix and i am developing on Windows. So the r.js adapter for nodeJS from ...
FredyC's user avatar
  • 4,067
1 vote
0 answers
805 views

Options for communicating between Chrome Extension and Embedding Page's Javascript

I am monitoring browser events such as when a new tab is created. My extension needs to display these browser events in the new tab page. To make versioning easier I would like the extension to be as ...
vaughan's user avatar
  • 7,287
5 votes
5 answers
6k views

How to load Underscore library with RequireJS?

require(['underscore'], function ($, _) { ... }); Doesnt work! (_ is not a function) How to manage it?
williamv's user avatar
18 votes
1 answer
4k views

requireJs order plugin: can it exist in a different path than the require.js basePath?

when using the order plugin require.js looks for it in the given basePath/order.js example: require( { baseUrl: '/public/js/' }, [ 'require', ...
Sander's user avatar
  • 13.4k
17 votes
2 answers
5k views

Backbone.js & require.js: how do I transform my models, views and collections to require.js modules?

I am working on a javascript app with backbone.js, that said, for ease of development I structure my files this way app | + views | L movieRow.js | L movieDetail.js | + models | L ...
Sander's user avatar
  • 13.4k
7 votes
1 answer
2k views

In RequireJs, how do I instruct the optimizer to to produce hash output files names?

I run the optimizer like this sudo /usr/local/bin/node /tmp/r.j/r.js -o name=main out=test.js baseUrl=. for test Now, how do I tell the optimizer to output the filename as a hash of the content (...
Quintin Par's user avatar
  • 16.2k
3 votes
1 answer
564 views

Requires: ordering jQuery-UI after jQuery in priority download

I am loading jQuery like this require({ baseUrl: '{{ STATIC_URL }}js', paths: { jQuery: 'https://ajax.googleapis.com/ajax/libs/jQuery/1.5.1/jquery.min', jQueryui: 'http://...
Quintin Par's user avatar
  • 16.2k
0 votes
1 answer
311 views

Execute Javascript before launching the default XUL page

Have to execute scripts using spidermonkey(jagermonkey) javascript engine availalble within XULRunner.The javascript has some dependent Javascript libraries like requriejs/commonjs etc. RequireJS ...
Yeshvanthni's user avatar
3 votes
3 answers
2k views

How can I test client side coffeescript/js using node with expresso/jasmine/<other>

I have a web app where the client side stuff is written with coffeescript and loaded with require.js. I would like to be able to isolate and test this stuff using a node based test runner such as ...
Ben Ford's user avatar
  • 2,087
0 votes
2 answers
1k views

Loading jquery.jstree.js using requireJS doens't work in IE

Loading jquery.jstree.js using requireJS doens't work in IE. When I try to load the JSTree plugin (jquery.jstree.js) using requireJS it fails in IE8 with follwing JS error. Message: Could not get ...
Alphonso's user avatar
1 vote
1 answer
2k views

Using a Javascript Loader with jQuery "undefined"

I am using a Javascript Loader [ requireJS ] which loads scripts in parallel to content - however, I have a problem. i.e. require('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'); ...
Tom's user avatar
  • 11
0 votes
1 answer
198 views

Google async tracker logs new visit every "page view"

On a single page webapp, I've implemented the google async tracker. I created a class to be able to make some simple calls to be able to track users across the site: var GoogleAnalytics = { ...
Jesse's user avatar
  • 10.4k
0 votes
1 answer
725 views

requirejs plugin loads module in fresh context

I want to have a module load multiple times on a page, with a unique context for each instance. There are two normal ways to do this. the module can return a constructor i can explicitly run the ...
chrispitzer's user avatar
  • 1,049
10 votes
2 answers
3k views

RequireJS and Headless Test-Driven Development

I'm looking to use RequireJS for my next big JS project however I am having a hard time figuring out how to test for it in a headless testing environment. I'm new to both RequireJS and the test-driven ...
Spencer Carnage's user avatar
6 votes
2 answers
3k views

How to structure multiple pages with RequireJS

How to structure multiple pages with RequireJS? Is, like the following sample, declaring every class in app.js is the right thing to do? Has every html file to declare the <script data-main="src/...
yves amsellem's user avatar

15 30 50 per page