This template contains standard distribution of Play Framework 2.6.0 along with UI built with Angular (possibly latest).
Angular 2 application is contained in separate directory ui
and is scaffolded using Angular-CLI. I've found WebJars and Sbt-Web based frontend build to be too slow and limited for my liking, so SBT is linked with Angular-CLI to handle frontend build.
These three are required globally. sbt-js-engine
will not be supported (and why should it - it's not like you can develop in Angular without node and npm anyway).
There are some small albeit important deviations from standard distribution of PF 2.6.0 and they are mostly related to sbt build and testing harness:
project/plugins.sbt
since Angular-CLI now handles frontend buildUIBuildHook
was added to project/
- it's job is handling node modules installation via npm
and npm run build
when Play is run in dev mode.build.sbt
file contains UI build tasks: npm modules installation and karma tests running along with Play testsIntegrationSpec
was removed, as Selenium Webdriver driven E2E tests are useless due to Protractor integration.ProtractorSpec
test class in test
. I owe that part to unnamed chinese coder who already battled with the idea of running Protractor tests from SBT and failed, so that I didn't have to. Thank you buddy!ui
folder don't cause Play reloads, but are observed (and handled) by Angular-CLI when Play is running in dev mode.About the Angular 2 app:
npm run start
in ui/
directory - this will run ng serve
Migration from beta angular-cli version of this seed (pre-march 2017):
--extract-css
in Angular CLI's docspublic/ui
directory to handle Issue #4 related to Play not refreshing files from unmanaged sources. That requires small changes in path given to Assets controller in Play views serving Angular App.Migration from older version of this seed:
ui
directoryTestBed
instead of inject
, use async
tests for Zone.js async trackingmain.ts
will need some refactoring to match new one - we're using Angular 2 modules now.Good luck!
Feel free to ask questions, post issues and even PRs if you find this seed broken or lacking in any way.
All libraries and frameworks are licensed under their own licenses. Everything else (meaning my glue code) is under MIT:
The MIT License (MIT)
Copyright (c) 2016 Łukasz Biały
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.