Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 2.04 KB

05-development-tips.md

File metadata and controls

61 lines (42 loc) · 2.04 KB

Development tips

Client-side development

watch/reload

There is a make watch task available to build and watch for development changes. View it on port 3000 - it uses Browsersync under the hood.

If you use m.thegulocal.com it will try port 3000 and fall back to 9000 if unavailable.

make watch

Testing your JavaScript

You can run the Jasmine unit test suite with

make test

Things to do before you commit

make fix
make validate

These will fix up the linting issues and check all the flow types to make sure you won't have any issue trying to push or with the simple parts of the build.

If you have already committed you can use make fix-commits to verify & fix your commited code. It's faster than make fix but you will need to amend your previous commits to get a clean history.

If you are wondering what other options make has, you can simply type make at the comment line.

Server-side development

Clean all projects

It is often necessary to clean the root project when 3rd-party libs have been updated for instance. Developers can use the cleanAll sbt task to clean all sbt projects, rather than only cleaning the current project.

Debugging Play application

You can debug your local Frontend application, by attaching a debugger.

  • Start Simple Build Tool in debug mode by typing ./sbt --debug.
  • Build and run your application. See "Running" for steps.
  • Use a debugger to attach to the remote Java process, on localhost:1044.

Any IDE debugger should be compatible. In IntelliJ, add a new Debug Configuration, based on the Remote default. Ensure the Transport is Socket, the Debugger mode is Attach, and the port is set to 1044. Start a new Debug session, and your breakpoints should be active.

Viewing AMP Pages

When running frontend locally, the AMP version of pages can be viewed by adding the ?amp querystring to the end of the URL. For example:

http://localhost:9000/world/2015/oct/15/obama-delay-withdrawal-us-troops-afghanistan?amp