compilationlessgoogle-chrome-devtoolsplayframework-2.3livecoding

Play framework - access assets on runtime


Gooday.

What i try to achieve: Use play while being able to edit javascript and lessfiles live in the chrome dev tool.

What i figured out: if you add the "public" folder of the project to the workspace in the ressources tab of the chrome dev tool, everything works as expected. Changes made in the chrome dev tool are saved to the according css and javascriptfiles and the page reflects the changes in realtime. The same happens if you add the 'app/assets/stylesheets' directory to the chrome dev workspace --> changes made to the file in the console are saved to the file saved on the disc.

Further if you run 'activator ~run' from the console, changes made on any file that require compilation trigger a recompilation. I got to that point that i could change my less code in the dev tool. Changes where ritten to the local file and made play recompile. All fine and dandy, buuut sadly - there it all ended :/

Problem: i work with less, and less is compiled to some misterious place (I haven't figured out where exactly yet). I can't add the css file (which was compiled from the less file) to the workspace in the chrome dev console if I don't know the directory - this means chrome doesnt know when to repaint the page and i get a 'ressource not available' error in the console. First i thought the css which actually styles the page is stored in the 'target' folder of the project, but this is not the case. (I added the target folder to the workspace, but changing the css files in this folder didn't reflect on the page)

My question: where is the css after being compiled from the less file? Or is there an other way to enable liveediting of less (or any compiled script/style source) in the browser?


Solution

  • https://www.playframework.com/documentation/2.0/AssetsLess tells you:

    Note that managed resources are not copied directly into your application public folder, but maintained in a separate folder in target/scala-2.9.1/resources_managed.