command to build webpack: (from modules directory)
~/node_modules/.bin/webpack tsol3d.js ../build/assembledTsol3d.js --output-library '$tsol3d'
can add --optimize-minimize
to generate minimized / optimized version
dev mode for build - monitor files and rebuild when they are saved:
~/node_modules/.bin/webpack tsol3d.js ../build/assembledTsol3d.js --output-library '$tsol3d' --progress --watch
- install git, setup github account
- install node (tested with version 7.4.0)
- check out the code from github
git clone [email protected]:dllahr/tsol3d.git
- from a terminal / command line, cd into where you cloned the above and do the following from there
- install http-server with npm
npm install -g http-server
- run the http server:
http-server .
- try things out:
- open http://127.0.0.1:8080 in your browser
- navigate to "tests", then choose e.g. "test_TIM_6mer_fragment_A73_I78.html"
- try to rotate, zoom, click the buttons etc.
- install webpack
npm install -g webpack
- run webpack in development mode (it will monitor for file changes and rebuild the library):
- cd into the "modules" subdirectory
- run webpack:
~/node_modules/.bin/webpack tsol3d.js ../build/assembledTsol3d.js --output-library '$tsol3d' --progress --watch
- try it out:
- edit the file modules/tim6merFragmentA73I78.js, change one of the entries in the line that assigns "button_values" e.g. "stick" to "stick hello world"
- notice that in the terminal where you ran the webpack command it has produced some output indicating the changed file it noticed, and that the new library was produced
- refresh the browser (make sure caching is off), notice that the button text you edited has changed (e.g. from "stick" to "stick hello world")
In this example we'll make a rendering of the structure of glucose.
- create new module
- in modules, copy simpleTemplate.js to glucose.js
- rename the module in the file - do a find / replace of simpleTemplate --> glucose
- add the structure pdb file to data directory (in this case, added glucose.pdb)
- reference the new module in tsol3d.js - edit tsol3d.js (also in modules directory)
- copy all simpleTemplate or simple_template entries and make an analogous entry for glucose
- e.g. "import glucose from './glucose'"
- export const export_glucose = glucose;
- etc.
- important note: when editing the builderMap to add an entry, need to add a comma to the end of the previous line
- copy all simpleTemplate or simple_template entries and make an analogous entry for glucose
- create the test
- in tests, copy test_simple_template.html to test_glucose.html
- edit the
<h2>
(header level 2) line to say "Glucose" instead of "Simple Template" - edit the line in the script that calls $tsol3d
- change it to call
export_glucose
instead ofexport_simpleTemplate
- change the location of the data to be
../data/glucose.pdb
- change it to call
- try it out in your local browser
- if it is working, add it to your git repo / github repository
- check which files were modified:
git status
- should be modules/tsol3d.js
- untracked should be:
- modules/glucose.js
- tests/test_glucose.html
- update your repository
git fetch
git pull
- add files to be committed
git add modules/glucose.js
git add tests/test_glucose.html
git add modules/tsol3d.js
- commit:
git commit -m "added view of glucose"
- (with a message relevant to the view you've added)
- push to github:
git push
- check which files were modified: