Created
June 22, 2012 05:09
-
-
Save hexx/2970364 to your computer and use it in GitHub Desktop.
play-jsx PlayJsxPlugin.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.hexx | |
import sbt._ | |
import sbt.Keys._ | |
object PlayJsxPlugin extends Plugin { | |
val jsxEntryPoints = SettingKey[PathFinder]("play-jsx-entry-points") | |
val jsxOptions = SettingKey[Seq[String]]("play-jsx-options") | |
val JsxCompiler = PlayProject.AssetsCompiler("jsx", | |
(_ ** "*.jsx"), | |
jsxEntryPoints, | |
{ (name, min) => name.replace(".jsx", if (min) ".min.js" else ".js") }, | |
{ (jsxFile, options) => com.github.hexx.JsxCompiler.compile(jsxFile, options) }, | |
jsxOptions | |
) | |
override val settings = Seq( | |
jsxEntryPoints <<= (sourceDirectory in Compile)(base => base / "assets" ** "*.jsx"), | |
jsxOptions := Seq.empty[String], | |
resourceGenerators in Compile <+= JsxCompiler | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment