From 8fe9048dc82c0c96d7bbf34253cbd5b87d1fffa3 Mon Sep 17 00:00:00 2001 From: TaoGang Date: Fri, 8 Jan 2016 10:58:21 +0800 Subject: [PATCH] Add js build --- docs/install.txt | 3 ++ package/main.py | 5 ++ package/static/build.js | 11 +++++ package/static/index.html | 2 +- package/static/index_debug.html | 81 +++++++++++++++++++++++++++++++++ package/static/package.json | 9 ++-- 6 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 package/static/build.js create mode 100755 package/static/index_debug.html diff --git a/docs/install.txt b/docs/install.txt index 95324bb..055c197 100644 --- a/docs/install.txt +++ b/docs/install.txt @@ -13,6 +13,9 @@ npm install babel-preset-react --save babel --presets es2015,react --watch js/ --out-dir lib/ +npm install requirejs --save +node node_modules/requirejs/bin/r.js -o build.js + python package/main.py http://localhost:5000 diff --git a/package/main.py b/package/main.py index da1185e..1a7e336 100755 --- a/package/main.py +++ b/package/main.py @@ -23,6 +23,11 @@ def index(): return app.send_static_file('index.html') +@app.route('/debug') +def index_debug(): + return app.send_static_file('index_debug.html') + + @app.route('/csvdata', methods=['GET', 'POST']) def csvdata(): if request.method == 'POST': diff --git a/package/static/build.js b/package/static/build.js new file mode 100644 index 0000000..0726c7b --- /dev/null +++ b/package/static/build.js @@ -0,0 +1,11 @@ +({ + baseUrl: "./lib", + paths: { + comp: './components', + viz: './visualization', + event: './event', + data: './data' + }, + name: "app", + out: "main-built.js" +}) \ No newline at end of file diff --git a/package/static/index.html b/package/static/index.html index d7bd91e..f6cf527 100755 --- a/package/static/index.html +++ b/package/static/index.html @@ -76,6 +76,6 @@ }); - + \ No newline at end of file diff --git a/package/static/index_debug.html b/package/static/index_debug.html new file mode 100755 index 0000000..d7bd91e --- /dev/null +++ b/package/static/index_debug.html @@ -0,0 +1,81 @@ + + + + + Data Play + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/package/static/package.json b/package/static/package.json index 980c233..676e259 100644 --- a/package/static/package.json +++ b/package/static/package.json @@ -4,13 +4,14 @@ "description": "", "main": "", "dependencies": { + "babel": "^6.3.13", "babel-core": "^6.3.21", + "babel-preset-es2015": "^6.3.13", + "babel-preset-react": "^6.3.13", "babelify": "^7.2.0", - "babel": "^6.3.13", "react": "^0.14.3", - "babel-preset-react": "^6.3.13", - "babel-preset-es2015": "^6.3.13", - "react-dom": "^0.14.3" + "react-dom": "^0.14.3", + "requirejs": "^2.1.22" }, "devDependencies": {}, "scripts": { -- GitLab