forked from enviPath/enviPy
Current Dev State
This commit is contained in:
18
static/js/ketcher2/node_modules/exposify/example/build.js
generated
vendored
Normal file
18
static/js/ketcher2/node_modules/exposify/example/build.js
generated
vendored
Normal 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'))
|
||||
5
static/js/ketcher2/node_modules/exposify/example/build.sh
generated
vendored
Normal file
5
static/js/ketcher2/node_modules/exposify/example/build.sh
generated
vendored
Normal 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
|
||||
25
static/js/ketcher2/node_modules/exposify/example/index.html
generated
vendored
Normal file
25
static/js/ketcher2/node_modules/exposify/example/index.html
generated
vendored
Normal 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>
|
||||
7
static/js/ketcher2/node_modules/exposify/example/main.js
generated
vendored
Normal file
7
static/js/ketcher2/node_modules/exposify/example/main.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var $ = require('jquery')
|
||||
, THREE = require('three')
|
||||
|
||||
console.log('THREE revision: ', THREE.REVISION);
|
||||
console.log('jquery version: ', $().jquery);
|
||||
Reference in New Issue
Block a user