Play 2.3 sbt-concat does not work in prod

I want to use this plugin

addSbtPlugin ("net.ground5hark.sbt"% "sbt-concat"% "0.1.8")

To combine my assets.

I have 3 groups:

Concat.groups := Seq( "concat_main.css" -> group(Seq( "stylesheets/bootstrap.min.css", "stylesheets/font-awesome.css", "stylesheets/totem/sidebar/component.css", "stylesheets/main.min.css" )), "concat_main.js" -> group(Seq( "javascripts/jquery-2.1.0.min.js", "javascripts/bootstrap.min.js", "javascripts/totemPage/sidebar/modernizr.custom.js", "javascripts/totemPage/respond.min.js", "javascripts/totemPage/html5shiv.js", "javascripts/totemPage/sidebar/classie.js", "javascripts/main.js" )), "concat_noel.js" -> group(Seq( "javascripts/totemPage/ouibounce-modal.js", "javascripts/ouibounce_modal.js", "javascripts/homePage.js", "javascripts/totemPage/jquery.cookie.js", "javascripts/embed.js" )) ) Concat.parentDir := "public/main/javascripts" pipelineStages in Assets := Seq(concat, uglify, digest, gzip) 

Files are created in dev, I can access

 <link rel="stylesheet" href="@routes.Assets.versioned("javascripts/concat_main.css")"> <script src="@routes.Assets.versioned("javascripts/concat_main.js")" type="text/javascript"></script> 

But with activator start I have 404.

+5
source share
1 answer

In the sbt-web documentation you can read that:

If you have a need for pipelined assets in your development environment (during playback), then you can embrace configStages into your asset configuration.

pipelineStages in assets: = Seq (myPipelineTask)

And this is what you did, which sets the pipelineStages key to the Asset Configuration area. However, this only works for development mode. To start the pipeline in production mode, you must set the pipelineStages key to the Global Configuration area . In your case, it will look like this:

 pipelineStages := Seq(concat, uglify, digest, gzip) 
+4
source

Source: https://habr.com/ru/post/1207815/


All Articles