Skip to content

Add WebJar class for accessing WebJar files#635

Open
valencik wants to merge 2 commits intomainfrom
webjar-helper
Open

Add WebJar class for accessing WebJar files#635
valencik wants to merge 2 commits intomainfrom
webjar-helper

Conversation

@valencik
Copy link
Copy Markdown
Member

Closes #633

There's basically two features of this work:

  • We only need to specify the WebJar version once in the using dep directive, this makes manually bumping easier.
  • We reduce the boilerplate of loading a file from a WebJar

Felt weird doing all this without fs2 or IO, but so far none of our uses of this are in IO.
The whole org.graalvm.polyglot.Context stuff feels like it could have a cool little micro library around it.

@valencik valencik self-assigned this Apr 10, 2026
@valencik valencik requested a review from armanbilge April 10, 2026 12:39
build.scala Outdated
Comment on lines +477 to +479
val stream = Thread
.currentThread()
.getContextClassLoader
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the ClassLoader should be a property of the WebJar class, so that the same one is used consistently each time (and it's not at the whim of the thread it's running on).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I've replaced these two bits of code with:

private val classLoader = classOf[WebJar].getClassLoader

@valencik valencik requested a review from armanbilge April 10, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smarter loading of resources from WebJars

2 participants