在Playframework 2.3中编译较少

时间:2015-06-24 14:52:21

标签: less sbt playframework-2.3

我正在尝试使用this project编译Less文件。问题是我跑的时候

$ activator publish-local

抛出以下错误

object less is not a member of package com.typesafe.sbt
  import com.typesafe.sbt.less.Import.LessKeys
                          ^
sbt.compiler.EvalException: Type error in expression
  at sbt.compiler.Eval.checkError(Eval.scala:343)
  at sbt.compiler.Eval.compileAndLoad(Eval.scala:165)

问题是编译器找不到导入项目的路径。也许我应该改变导入,否则我会忘记别的东西。

谢谢

1 个答案:

答案 0 :(得分:1)

问题是我把代码放在错误的地方

plugins.sbt中你应该添加

resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases"    

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")

build.sbt

import com.typesafe.sbt.web.SbtWeb.autoImport._
import com.typesafe.sbt.less.Import.LessKeys

lazy val root = (project in file(".")).enablePlugins(PlayScala).enablePlugins(SbtWeb)

includeFilter in (Assets, LessKeys.less) := "*.less"

// for minified *.min.css files
LessKeys.compress := true

pipelineStages := Seq(uglify, digest, gzip)