C
C
Cat Anton2014-10-25 11:30:55
JavaScript
Cat Anton, 2014-10-25 11:30:55

How to include require.js in build file using r.js?

In all examples found on the Internet using r.js, all js files (except require.js) are combined into one, and then included as follows:

<script data-main="js/build.js" src="js/require.js"></script>

As a result, we get 2 requests to the server.
How should r.js (grunt-contrib-requirejs) be configured to produce a build.js file that already includes require.js?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2014-10-25
@27cm

Everything was decided banally:

{
    // ...
    include: ["js/require.js" /* ... */],
    out: "js/index.js"
}

A
aen, 2014-10-25
@aen

Well, since you figured it out, you can take the next step and look at https://github.com/jrburke/almond

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question