artasparks / glift

Go Lightweight Frontend
MIT License
115 stars 33 forks source link

Investigate using requirejs or providing namespaces via goog.provide #160

Closed artasparks closed 8 years ago

artasparks commented 8 years ago

Currently I provide all the namespaces manually, which is a little obnoxious because it means that ordering of the JS files within a directory matter. The real issue is dev mode -- compiled mode will work fine (except for some weird design choices I made in src/displays/board). An easy way to begin could be by hacking goog.provide for dev mode and/or copying the relevant methods from goog.base:

http://google.github.io/closure-library/api/source/closure/goog/base.js.src.html#l287

artasparks commented 8 years ago

In theory, the ordering issue could be solved in compiled-mode with goog.requires, but dev mode is still problematic.

artasparks commented 8 years ago

I think this is more or less dead in the water. I'll probably use typescript before I fix this. goog.require is pretty nasty because it implies an asynchronous module definition (AMD), which is just annoying. Requirejs doesn't really work with Closure types.