真的很简单。
我正在使用playframework 2.4.x。
我有一个文件app / assets / stylesheets / main.less包含这些内容:
@import "lib/bootstrap/less/bootstrap.less";
// This should not go away!
body {
background-color: #6600FF;
}
当项目重新编译(激活器编译或使用〜运行文件加载)时,文件将恢复为仅包含导入行的文件:
@import "lib/bootstrap/less/bootstrap.less";
我没有收到任何错误消息,没有明显的抱怨,它似乎只是默默地失败。
我可能做错了什么?
我可以检查哪些设置以确保我没有弄乱某些东西?
我的第一个假设是用户错误而不是错误。到目前为止,我的谷歌技能已经失败了。
build.sbt的内容:
name := """webgame"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs,
"org.webjars" % "bootstrap" % "3.3.6", //Bootstrap
"mysql" % "mysql-connector-java" % "5.1.38" //Mysql
)
// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
// The following two lines should automatically add any .less files in app/assets/stylesheets
// to the list of assets to compile, as well as telling it to skip any files that have an
// underscore ("_") at the start of their name. This should let us use an underscore to designate
// a file to treat as a partial.
//
// A partial is a chunk of code that is put into an individual file for use in other files, like
// an include file or similar. It is part of the DRY approach to writing reusable code.
//
includeFilter in (Assets, LessKeys.less) := "*.less"
excludeFilter in (Assets, LessKeys.less) := "_*.less"
project / plugins.sbt的内容:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")