Giter VIP home page Giter VIP logo

play2-typescript's Introduction

play2-typescript

[TypeScript] 1 asset handling for [Play 2.0] 2, implemented as an [sbt] 3 plugin (very similar to Play's handling of CoffeeScript and LESS).

Prerequisites

The plugin assumes the availability of the tsc - the TypeScript compiler executable. With node.js and npm installed, run

npm install -g typescript

to install tsc globally, thereby installing not only the module, but also the executable.

Installation

In your Play application folder, add

resolvers += "Sonatype OSS Snapshots Repository" at "http://oss.sonatype.org/content/groups/public"

addSbtPlugin("com.github.mumoshu" % "play2-typescript" % "0.1.2-SNAPSHOT")

to project/plugins.sbt.

The plugin automatically registers for compilation of app/assets/**/*.ts, that is all typescript files in your app/assets directory.

You may also want to import/export modules or classes across multiple .ts files, enable Google Closure Compiler in your project/Build.scala:

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
    // Enable Google Closure Compiler to enable `require()` function utilized by TypeScript to enable importing modules at runtime.
    javascriptEntryPoints <<= baseDirectory(base => base / "app" / "assets" ** "*.js")
  )
)

sbt settings

  • compile:resource-generators: The typescript file watcher is being added here
  • play-typescript-entry-points: All files matching app/assets/**/*.ts, except files starting in an underscore
  • play-typescript-options: A sequence of strings passed to typescript as command-line flags

Acknowledgements

This plugin is based on Juha Litola's [play-sass][play-sass] plugin for handling Sass assets.

License

Copyright (c) 2012 KUOKA Yusuke

Apache v2 licensing, for details see file LICENSE.

play2-typescript's People

Contributors

mumoshu avatar pkmishra avatar jayceecam avatar hiradimir avatar

Watchers

 avatar James Cloos 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.