Skip to content

How To Contribute to Simulator?

Shubhankar Sharma edited this page Jun 2, 2020 · 2 revisions

author: @shubhankarsharma00

Once this PR is merged in a new branch most of the simulator side development is going to shift to that branch and This is a guide on how to start development with webpacker.

Currently, the JS is loaded in the simulator by using <<%= javascript_pack_tag 'simulator' %> in app/views/logix/simulator.html.erb which webpacker will convert to the name of the automatically bundled file in public/packs/js during runtime.

app/javascript/packs/simulator.js imports public/src/app.js which is where we call setup function onto the HTML page to set up the whole simulator.

How to run your code offline:

run ./bin/webpack to compile your codebase into a single compiled and minified file. This file will be automatically included in your HTML page where the pack has been included using javascript_pack_tag.

run ./bin/webpack-dev-server when developing a feature and making continuous changes. webpack-dev-server has Hot Module Reload and some other features to streamline how the development works. See the documentation for more information.

How to use variable across various files: Currently, the variables that are being used in more than one file has a Set and Get function based on the need. For eg: layoutMode variable used to create nodes is defined in layoutMode.js and 2 functions layoutModeSet(param) and layoutModeGet() can be imported to write and read the variable to avoid any unnecessary or accidental read and write.

During production ./bin/webpack changes to webpack:compile and is automatically included in assets:precompile. So there is no need to type it in separately unless you want to test some webpack changes specifically.

Clone this wiki locally