THIS PROJECT IS NO LONGER MAINTAINED
$ npm i -g webmodules
$ mkdir myapp
$ cd myapp
$ npm install jquery
public/index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/commonjs" data-src="app.js"></script>
<script src="/node_modules/webmodules/runtime.js"></script>
</head>
<body>
<div id="content"></div>
</body>
</html>
public/app.js
var $ = require('jquery');
var sub = require('./sub.js');
$(document).ready(function($) {
$('#content').html('hello, ' + sub.value);
});
public/sub.js
exports.value = 'world';
- launch
$ wpm up ./public
$ npm i webmodules express
- lib/index.js
var webmodules = require('webmodules');
var express = require('express');
var app = express()
.use('/node_modules', webmodules.router())
.use('/', express.static('public'))
.listen(9000);
$ node lib
Licensed under the MIT License. See LICENSE for the full license text.