Grails and modern Javascript development, crossing the gap

View a sample project with the ideas from this post here.

We want to use shiny new JS libraries that tend to only be available on NPM, and we want unit tests to be blazing fast.

Why it’s not easy

  • Grails and asset-pipeline have a powerful plugin architecture (e.g. plugins can provide assets but your project can override them), but that means you need to use asset-pipeline to resolve files. This makes it difficult to use with tools like Webpack and browserify. (see less-asset-pipeline for an example of a JS tool hooking into asset-pipeline for file resolution, it involves RhinoJS and the apparently-abandoned env.js)
  • Tests need to be fast if we want people to use them, running browser-based tests in PhantomJS or a running app server is too slow.

The key

The sample repo has a full example of pulling redux-devtools from NPM, webpacking it to the asset-pipeline world, importing it into an ES2015 module, and testing that module with a Mocha spec.

Module formats

Incremental upgrades

There’s more info about all of the implementation details in the sample repo’s readme. If you have questions feel free to reach out via email or twitter.

Senior Software Development Engineer @ Amazon. Trumpet player, drum corps enthusiast.

Senior Software Development Engineer @ Amazon. Trumpet player, drum corps enthusiast.