Search code examples
scalaplayframeworkcoffeescripttypesafe-activator

How do I automatically compile Coffeescript using Typesafe?


First of all I would like to mention that I have downloaded "play-scala-intro" template from Playframework official website, after running this project using terminal command ./activator ui (Ubuntu), the Typesafe UI web application started to listen on port 8888, and "play-scala-intro" application on port 9000.

At every change and save inside the project, application is rebuilt and the single thing what is not is Coffeescript.

I'm trying to recompile somehow Coffeescript, on project rebuild. Activator version what I use is 1.3.3


Solution

  • I think the root cause might be related to the activator UI running Play in prod mode vs develop mode. This question is similar:

    How to run play project in dev mode with Typesafe Activator UI

    According to Play CoffeeScript Page

    CoffeeScript sources are compiled automatically during an assets command, or when you refresh any page in your browser while you are running in development mode. Any compilation errors will be displayed in your browser:

    To run in dev mode go into the folder that got created when you fetched the template and use the command: activator run

    For what its worth to run in prod mode you use activator start command.

    Here is what I saw in the console which led me to believe it is prod mode: enter image description here

    This might only be the UI application but like you I could not get the coffeescript to recompile in this configuration.

    For some activator templates there is more content in the tutorial but this one relies on a video so if you are comfortable with an editor or IDE I think you can watch the associated video Introduction to Play Framework for Scala developers and follow along locally.