Re: [requirejs] single page with html and javascript

Showing 1-1 of 1 messages
Re: [requirejs] single page with html and javascript James Burke 6/10/13 2:15 PM
You can include require.js in the source bundle, see the "requireLib"
use in the second example in this section:

That said, if the goal is to have it all in one file, then including
require.js is likely overkill, and a smaller AMD API provider, like
almond is suggested instead:

For CSS or things like HTML templates, if AMD loader plugins are used,
then, depending on the loader plugin, they can inline their resources
as JS strings. Some loader plugins:

Note the loader plugins have to take advantage of the loader plugin
build APIs that r.js supports to get the resource inlining:


On Sat, Jun 1, 2013 at 8:16 AM, Lyn Headley <> wrote:
> I'm aiming for an optimized experience in which a single html page contains
> all the javascript and css and markup needed for a single-page app. From
> what I can tell, this is not a standard practice in the requirejs community,
> which tends to take an approach where the html page is first loaded, and
> then one or more javascript and css files. Even in the optimized r.js case
> the standard practice seems to involve a minimum of three http requests for
> javascript. This is of course a vast improvement over an unoptimized build
> with dozens of amd modules, but I wonder how to push it further. Is this as
> simple as concatenating the require.js source and the result of an r.js run,
> and then inserting all this js code into a <script> tag in my html page?
> Is anybody doing this or thinking about it?
> Thanks.
> --
> You received this message because you are subscribed to the Google Groups
> "requirejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
> For more options, visit