-
Notifications
You must be signed in to change notification settings - Fork 5
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
Get server side react from webjars #4
Comments
You're right, it is not an optimal solution. But for a real world application, a better solution has to be found. What I would like to achieve:
If you have any idea, please feel free to suggest them! |
So, I have figured out how to read the webjar file Assets.resourceNameAt("/" + WebJarAssetLocator.WEBJARS_PATH_PREFIX, WebJarAssets.locate("react.min.js"))
.flatMap(AssetInfo.resource)
.map(url => {
new String(readStream(url.openStream()))
}) There should be a better way, but this is actually working. |
@jamesward or @huntc might know if there's a better way to read a source from a webjar |
@pasviegas If you're using sbt-web then |
Are you trying to read the WebJar asset's contents in a running Play app or in an sbt plugin? |
In a running play app inside a controller. The code in my previous comment actually works, but I am guessing there should a better way. :) |
Here is how I'd do it:
This uses
|
Cool. Thanks for the tips! |
Thanks a lot :) |
To resolve `var React = require('./react'), trireme needs a real file and not a stream from a jar. I think we can work around this like I did for the public folder: |
I really don't know how to do that, but it seems odd to have react in two different places.
Do you have any idea on how to do that?
Thanks
The text was updated successfully, but these errors were encountered: