Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

View File

@ -0,0 +1,18 @@
'use strict';
var browserify = require('browserify')
, path = require('path')
, fs = require('fs')
, exposify = require('exposify')
// configure what we want to expose
exposify.config = { jquery: '$', three: 'THREE' };
browserify()
.require(require.resolve('./main'), { entry: true })
.transform(exposify)
.bundle({ debug: true })
.on('end', function () {
console.log('all done, open index.html')
})
.pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8'))

View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
EXPOSIFY_CONFIG='{ "jquery": "$", "three": "THREE" }' \
../node_modules/.bin/browserify --debug -t exposify main.js > bundle.js
open index.html

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>exposify example</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</head>
<body>
<h2>exposify example</h2>
<p>Both jquery and three.js are loaded from a cdn via a script tag inside the head</p>
<p>
<span>However they are required as usual inside our modules, i.e. <pre><code>var $ = require('jquery')</code></pre></span>
<span>exposify makes the adjustements to make this all work</span>
</p>
<p>Please open the dev console to see logged versions of both libraries and investigate the <pre>main.js</pre> in the sources tab
in order to find out how it works (all jquery and three require calls were replaced with assignments from the window).
</p>
<script type="text/javascript" src="bundle.js"></script>
</body>
</html>

View File

@ -0,0 +1,7 @@
'use strict';
var $ = require('jquery')
, THREE = require('three')
console.log('THREE revision: ', THREE.REVISION);
console.log('jquery version: ', $().jquery);