Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Self service RequireJS packages
JavaScript Shell
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.openshift
lib
tests
views
.gitignore
.travis.yml
Makefile
README.md
deplist.txt
package.json
server.js
todo.md

README.md

Clique

Self service AMD packages.

Its generally considered better to deliver a web page's JS in as few requests as possible. The solution should be simple and not rely on a build or similiar pre-deploy step.

Minimising requests shouldn't affect cacheability. JS urls that include a unique identifier in their url (such as a version number) should still be able to be publically far-future cached and delivered in a single request.

A project's use of a JS loader should unaffected by how the JS is packaged.

npm install clique

Node

Use clique to generate the package url.

var clique = require('clique');

var url = clique.create([
    'http://code.jquery.com/jquery-1.7.2.min.js',
    'http://example.com/some.js'
]);

Now in your template:

'<script type="text/javascript" src="' + url + '"></script>'

Browser

In the browser:

require(['http://clique.rhodgson.co.uk/clique.js'], function (clique) {

    var head = document.getElementsByTagName("head")[0],
        script = document.createElement("script");

    script.url = clique.create([
        'http://code.jquery.com/jquery-1.7.2.min.js',
        'http://example.com/some.js'
    ]);

    head.appendChild(script);

});
Something went wrong with that request. Please try again.