Compile Less in Playframework 2.3

562 Views Asked by At

I am trying to compile Less files with this project. The problem is that when I run

$ activator publish-local

It is thrown the following error

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)

The problem is that the compiler cannot find the path to import the project. Maybe I should change the import, or I am forgetting something else.

Thank you

1

There are 1 best solutions below

0
agusgambina On

The problem was I was putting the code in the wrong places

In the plugins.sbt you should add

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

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

In the 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)