Giter Site home page Giter Site logo

ppanuccio / play-angular2-typescript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joost-de-vries/play-angular-typescript.g8

0.0 1.0 0.0 100 KB

An activator template for a Play Angular2 Typescript application

License: Other

TypeScript 34.36% CSS 18.78% HTML 29.51% Scala 17.09% JavaScript 0.25%

play-angular2-typescript's Introduction

#Play Angular2 Typescript sample application Build Status

This is an activator template that generates a sample Play Angular2 RC4 Typescript 2.0 application.

As mentioned it features an Angular2 application with Typescript compilation integrated with the continuous compilation of Play Scala code. The Typescript code is linted with tslint.

##Installation Once you have activator installed you can run activator new play-angular2-typescript and you'll have a local application with a tutorial. Or you can just clone this repo and run sbt ~run.

NB: Make sure you don't have typescript installed globally. If you do have a global npm installation of typescript that version will be picked up. And then all bets are off. A symptom of having an older global typescript installation is that you get a JsTaskFailure / TypeError that the function convertCompilerOptionsFromJson can't be found. See this issue

##Getting started The NG2 application is the standard todomvc app. This Play project shows 3 ways of loading that app in the browser using Play.

  1. let the browser load the typescript files and have them compiled in the browser itself. This is easy to setup. But it makes greater computation demands on the client device. And it is really hard to find out about compilation errors. Which rather defies the added value of typed programming that typescript provides. This is implemented in this html file. This template hasn't been ported to Angular RC4 yet.
  2. let the Play framework compile the typescript files when they're changed. The browser will load all the resulting individual js files individually. That can quickly lead to slow initial loading as the number of ts files of your application increases. This is implemented in this html file
  3. let the Play framework compile the typescript files into one single javascript file. This will load much quicker. This is implemented in this html file This template hasn't been ported to Angular RC4 yet.

For a lot of production applications option 3 will be required. While option 2 is nicer for development. We can do both without changing our source code by using sbt ~run for the former and sbt stage -DtsCompileMode=stage for the latter. So to get option 3 to work you'll have to provide that -DtsCompileMode=stage jvm argument.

##what to do if

"I've created the application through activator and it runs fine in activator but it hangs when I try to run it through sbt"
This is a known problem with activator. Activator generates a file project\play-fork-run.sbt that causes this. If you remove it or comment out its contents the application will run in sbt.

##History

v0.2.0-beta.6

  • uses tslint 4.0.2

v0.2.0-beta.5

  • replace todomvc with tour of heroes as demo ng2 application. tx Isammoc
  • use 'tslint:reommended' as a basis for tslint rules. Downgrade typescript to a supported version by tslint 3.x

play-angular2-typescript's People

Contributors

detinho avatar isammoc avatar joost-de-vries avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.