-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access JS libraries from threepeny-gui application #249
Comments
Once upon a time, I wrote a patch for doing that. Though I stopped using it after |
If I understand correctly, In contrast, Threepenny assumes that all JavaScripts runs within a single browser window. A package manager like bower can be used to compile JavaScript dependencies into a single As far as You can also load more scripts in the document head by providing your own custom HTML file with |
OK, I’ll try these and see how they go.
This is what I’m doing already… the problem is that I can only use scripts from inside the designated static directory, and I can’t see any straightforward way of making |
@bradrn do you have any updates on this? I'm trying to use CodeMirror aswell and I'd be interested in how ( or if ) you eventually got it to work. |
@onthepeakofnormal Unfortunately not; for the application I was working on I eventually gave up on |
Well I got it working with this approach you mentioned:
you can have a look here, if your interested: for my purposes this actually works ok |
@onthepeakofnormal Sorry, I should have been clearer: I did successfully use that method for a while, but eventually I decided I wasn’t happy with it, so for this and other reasons I eventually moved to Qt. |
Let’s say I’ve found a reasonably large JS library I want to use in my threepenny-gui application (e.g. CodeMirror or something similar). In general, there seem to be two major methods of using such libraries:
npm
to specify the library as a dependency, then link to the appropriate scripts innode_modules
Option (1) is easy in threepenny-gui: simply make sure to put the library into your
jsStatic
directory and prefix every reference to it with/static
, and everything will work. Option (2), however, is much more difficult — from what I can see,npm
can’t install libraries intojsStatic
, so there’s no way to use such libraries from a threepenny-gui application. In theory,loadDirectory
looks like it could help with this, but it also seems like I can use it only after the HTML page has been loaded, which means it actually doesn’t help after all. (Not that I’ve tested it, so I could be wrong on this.)So: is there any way I can use an
npm
-managed library in threepenny-gui? Or if not, would it be possible to add a way of doing this? (To me, the easiest solution seems to be allowing multiple static directories, but there could be others.)The text was updated successfully, but these errors were encountered: