How to integrate the process of creating npm / gulp / bower in sbt?

I have two separate git repositories, one contains a scala server built using sbt, the other contains a webapp interface built into npm / bower / gulp.

In the repo server, I already have the task of creating an autonomous bank (and not the standard package task); in frontend repo I can build with npm install && npm run build , which will lead to the _public offline directory.

Now I would like to include the UI _public during the assembly of the sbt jar task, I am wondering if there is a better way to do this otherwise than manually call an external process in sbt to call npm?

+7
scala npm bower sbt gulp
source share
2 answers

If your interface uses NPM and Gulp to build the application, you need to run it using the NodeJS mechanism (or maybe JVM engines like Rhino or Nashorn may not be sure), and this requires an external process.

Question: Ask yourself: Do you really want to associate the deployment of your backend with the deployment of your interface? Is there no case when you just want to deploy one and not the other?

I think using SBT to deploy an interface is very nice, but if your interface is complex, you would prefer it separately from SBT.

Your JS application does not have to be used as a public Play asset, you can simply deploy it in its place and refer to it in the Play HTML template.

+4
source share

I agree with Sebastien to leave the third-party developer (and possibly even deploy) separately from your back-end, as I am in the process of learning this lesson.

However, look at SbtWeb (task workflow) in tandem with WebJars (package management). SbtWeb has several plugins that can cover the basics (uglify, concat, filter), and in some cases I think that if node is installed, it can use it directly.

0
source share

All Articles