I have a project using Play Framework 2.3 and I'm having some issues with how JS files are handled throughout the asset pipeline. I want to process my JS source files differently depending on if the application is started in dev or prod mode. Specifically, I wan't to run pipeline stages called transpile
and watch
in dev mode but stages transpile
and uglify
in prod mode.
I've set up the global pipeline stages with pipelineStages := Seq(transpile, uglify)
and this runs only in prod mode, as expected.
Now, for dev mode I've set it up with pipelineStages in Assets := Seq(transpile, watch)
which works for dev but my problem is that this also runs in prod mode. The watch
needs to only run in dev mode.
I haven't been able to find much good information on this, the Play documentation doesn't even mention pipelineStages in Assets
and the sbt-web readme only mentions it in passing. Other than that I've only found a bunch of blog posts. From what I've read I got the impression that pipelineStages in Assets
was exclusive to dev mode but that assumption was evidently incorrect.
I understand that playRunHooks
is what is meant for dev exclusive stuff but afaik I can't use that for this since it runs after the configuration has been finalized and therefore can't be used to conditionally configure the pipeline stages.
My current, extremely ugly workaround for this problem is that I set a system property in playRunHooks
and have a wrapper around the watch
pipeline stage that checks this property when it gets invoked.
So is there any proper way to specify 'dev-only' pipeline stages for my sbt-web build? Any suggestions would be appreciated.
(We're also in the process of migrating to Play Framework 2.6, in case that gives me more possibilities)