[Play 2.3.4] How to make sbt-uglify to work?

305 views
Skip to first unread message

Łukasz Śliwiński

unread,
Sep 2, 2014, 3:33:36 PM9/2/14
to play-fr...@googlegroups.com
Hi,

I have problem to make sbt-uglify to work.

I have created new empty project by

 actnew play-java

And cutted javascript folder to assets folder.
Added sbt-uglify to plugins.sbt and changed build.sbt

You can that example in my github repo:

I don't know what I'm doing wrong.
Best regards,
Lukas 

Łukasz Śliwiński

unread,
Sep 4, 2014, 3:10:35 PM9/4/14
to play-fr...@googlegroups.com
Anybody can take a look?

alex s

unread,
Sep 4, 2014, 6:50:48 PM9/4/14
to play-fr...@googlegroups.com
1. Change @routes.Assets.at("javascripts/hello.js") to the @routes.Assets.versioned("javascripts/hello.js").
2. Don't forget that tasks in pipelineStages are not executed in dev mode by default.

четверг, 4 сентября 2014 г., 23:10:35 UTC+4 пользователь Łukasz Śliwiński написал:

Łukasz Śliwiński

unread,
Sep 5, 2014, 2:39:07 AM9/5/14
to play-fr...@googlegroups.com
Thx, you not mention but to use versioned you have to change route for assets to:
GET    /assets/*file    controllers.Assets.versioned(path="/public", file: Asset)

I didn't know that sbt-gzip, sbt-uglify, sbt-digest are not running in dev mode.
Can you give me quit tip how to run this tasks in run mode?

My target is to get functionality similar to https://github.com/edeustace/assets-loader for play 2.2.x

Best regards,
Lukas

alex s

unread,
Sep 5, 2014, 6:02:41 AM9/5/14
to play-fr...@googlegroups.com


пятница, 5 сентября 2014 г., 10:39:07 UTC+4 пользователь Łukasz Śliwiński написал:
I didn't know that sbt-gzip, sbt-uglify, sbt-digest are not running in dev mode.
Can you give me quit tip how to run this tasks in run mode?
 
I'll quote the sbt-web readme:
If you have some need for the assets produced by the pipelineStages in your development environment (during play run), then you can scope the pipelineStages to the Assets config.

pipelineStages in Assets := Seq(myPipelineTask)

Łukasz Śliwiński

unread,
Sep 5, 2014, 8:59:26 AM9/5/14
to play-fr...@googlegroups.com
That works, I can see that uglify is process files on run mode but they are not loaded by reverse router - controllers.Assets.versioned.
Is there any chance to load files as they are configured by pipelineStages in Assets := Seq(myPipelineTask)?

alex s

unread,
Sep 5, 2014, 4:54:08 PM9/5/14
to play-fr...@googlegroups.com
-GET     /assets/*file               controllers.Assets.versioned(path="/public", file)
+GET     /assets/*file               controllers.Assets.versioned(path="/public", file: Asset)

BTW, there is no need to include pipeline tasks in both pipelineStages and pipelineStages in Assets keys, each task should belong to only one key.

пятница, 5 сентября 2014 г., 16:59:26 UTC+4 пользователь Łukasz Śliwiński написал:

Łukasz Śliwiński

unread,
Sep 9, 2014, 7:24:00 AM9/9/14
to play-fr...@googlegroups.com
Thanks to your help I created example play project that is using:
sbt-uglify
sbt-gzip
sbt-digest
sbt-concat
Plugins are configure to work in run/development mode.

I also modyfied sbt-concatenate to add possibility to define multiple concatenation definitions -> https://github.com/nonameplum/sbt-concat

Best regars,
Lukas
Reply all
Reply to author
Forward
0 new messages