Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ def concatenate_js_files(js_files, output_filename):

def pack_js_files(js_files, output_filename):
concatenated_data = "/*packed*/"

uglifyjs_path = os.path.join(".", "node_modules", ".bin", "uglifyjs" + (".cmd" if sys.platform.startswith('win') else ""))

for js_file in js_files:
print("Processing " + js_file + " ", end="")

if os.path.exists(js_file):
# Minify the JS file using uglifyjs
minified_js = subprocess.run(["uglifyjs", js_file, "-c"], stdout=subprocess.PIPE, text=True)
minified_js = subprocess.run([uglifyjs_path, js_file, "-c"], stdout=subprocess.PIPE, text=True)
concatenated_data += minified_js.stdout + "\n"
print("\033[92mMinified\033[0m")
else:
Expand Down
168 changes: 168 additions & 0 deletions dist/litegraph.bundle.js

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions examples/use-bundle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>LiteGraph Test</title>
<link rel="stylesheet" type="text/css" href="../css/litegraph.css">
<script src="../dist/litegraph.bundle.js"></script>
<script type="module" src="../src/nodes/base.js"></script>
<!-- add other nodes you need -->
</head>
<body>
<canvas id='mycanvas' width='1024' height='720' style='border: 1px solid'></canvas>
<script type="module">
var graph = new LGraph();

var canvas = new LGraphCanvas("#mycanvas", graph);

var node_const = LiteGraph.createNode("basic/const");
node_const.pos = [200, 200];
graph.add(node_const);
node_const.setValue(4.5);

var node_watch = LiteGraph.createNode("basic/watch");
node_watch.pos = [700, 200];
graph.add(node_watch);

node_const.connect(0, node_watch, 0);

graph.start();
</script>
</body>
</html>
32 changes: 32 additions & 0 deletions examples/without-bundle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/litegraph.css">
</head>
<body style='width:100%; height:100%'>
<canvas id='mycanvas' width='1024' height='720' style='border: 1px solid'></canvas>
<script type="module">
import { LiteGraph } from "../src/litegraph.js";
import { LGraph } from "../src/lgraph.js";
import { LGraphCanvas } from "../src/lgraphcanvas.js";
import "../src/nodes/base.js"
// add other nodes you need

var graph = new LGraph();

var canvas = new LGraphCanvas("#mycanvas", graph);

var node_const = LiteGraph.createNode("basic/const");
node_const.pos = [200,200];
graph.add(node_const);
node_const.setValue(4.5);

var node_watch = LiteGraph.createNode("basic/watch");
node_watch.pos = [700,200];
graph.add(node_watch);

node_const.connect(0, node_watch, 0 );

graph.start()
</script>
</body>
</html>
Loading