Open hhzl opened 10 years ago
Is this an actual issue or code aesthetics?
Both.
It is an issue in case if you want your example be more than a quick hack (cf. your README.md
). The file index.html
contains duplication of code. No need for the declaration of a global variable which you map again in the Amber st code.
Are others going to learn from it how the mappings should to be? At the moment the setup is messy.
As there are only few examples around with proper mapping we should give care not to promote a style with unnecessary code.
Please have a look how I did it here https://github.com/hhzl/Amber-Paper-Demo/blob/master/index.html .
I have mapped PhysicsJS
(btw no alpha version) and 4 other JavaScript libraries all in the same index.html
file . The code is much more compact. Further simplifications might be possible.
Alternative: Do not use requireJS for PhysicsJS
at all. Just go for a global variable
<script src="bower_components/physicsjs/dist/physicsjs-0.6.0.js"></script>
Simple to understand and straightforward. In this case only a global variable window.Physics
.
The result of amber init
is treated as "boiler plate".
As in https://github.com/hhzl/Amber-Paper-Demo/issues/1