0.2.0 • Published 11 years ago

requireware v0.2.0

Weekly downloads
25
License
-
Repository
github
Last release
11 years ago

requireware

Simple middleware to provide asynchronous require() script loading in the browser.

var express = require('express')
  , requireware = require('requireware');

var app = express()

app.use('/scripts', requireware(__dirname + '/static/scripts'))
app.use(express.static(__dirname + '/static'));

console.log('http://localhost:3000');
app.listen(3000);

In your page:

<html>
<script src="/scripts">
// An inner script is run after content is asynchronously loaded.

// Load files which add items to `exports`
var EventEmitter = require('events').EventEmitter; 

// Load files which aren't `exports` aware.
require('jquery'); 

// Load remote files with a callback.
require.remote('http://example.com/remotescript.js', function () { /* ... */ })

</script>
<body>
  <h1>Content displayed before scripts are loaded.</h1>
</body>
</html>

License

MIT

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3-1

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1-3

11 years ago

0.0.1-2

11 years ago

0.0.1-1

11 years ago

0.0.1

11 years ago