Frontend development for play-cms is done with JavaScript (in contrast to the play-cms-demo application which also demonstrates scala.js).

All javascripts have to be referenced separately inside your template (no matter if defined as webjar or residing as javascript-file under public/*). Js packaging and minifying will be added in a later release.

Javascript configuration

Many javascript libraries use init-objects to configure their behavior. Often those init-objects contain messages displayed to the user. Since we want those messages to be available in every supported language, play-cms pre-renders a javascript-configuration with every request.

the configuration is defined in _config.scala.js-template and rendered when calling its route:

@* script with template variables that could be used in other javascript files *@
<script src="/javascripts/config" type="text/javascript"></script>

Note: Do not use the reverse router to reference the config since it should be overwriteable in your application with the same URL

The js configuration renders and gets delivered with an ETAG to prevent browsers from loading it again if unchanged.

Extending the javascript configration for a custom admin page

The js-configuration from play-cms can be overwritten/extended in your application. See more about this topic there: Frontend (Browser) Development in play-cms-demo