Plugin based on play-sass
- fixed incremental compilation issue in Windows
- fixed #14 issue with broken incremental compilation
- exception message shows full path to file
- changed compilation log message
- added
sbt-digest
andsbt-rjs
plugins toplay-sass-example
- fixed #12. removed
--sourcemap
parameter from sass command line. it prevents deprecation warning. - fixed #11. fixed problems with assets pipeline. many thanks to @huntc
Sass compiler needs to be installed for plugin to work. This means that sass
executable
needs to be found in path. Sass can be installed by installing sass
gem (minimal version 3.4.0).
gem install sass -v 3.4.0
You can verify that sass
has been installed by following command:
sass -v
Also you should install (opitonal) compass if you want to use it
gem install compass
- Add line to
project/plugins.sbt
resolvers += Resolver.url("GitHub repository", url("http://shaggyyeti.github.io/releases"))(Resolver.ivyStylePatterns) addSbtPlugin("default" % "sbt-sass" % "0.1.9")
- Run
activator
- Clone from this repo
git clone https://github.com/ShaggyYeti/sbt-sass.git
- Enter to folder with sbt-sass and run
sbt
- In sbt-console execute command
publishLocal
- Add line in your play project to project/plugins.sbt
addSbtPlugin("default" % "sbt-sass" % "0.1.9")
- Run
activator
*.sass
and*.scss
files inapp/assets
directories will be automatically compiled to*.css
files- Files starting with
_
-character will be left out from compilation as per Play convention. - For example the result of compilation of
app/assets/test.scss
you can include by next line:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("test.css")">
- also, you can use
sbt-sass
withWebJars
. For example, webjar of Foundation:- add next line to
build.sbt
libraryDependencies ++= Seq( "org.webjars" %% "webjars-play" % "2.3.0", "org.webjars" % "foundation" % "5.3.0" )
- then you can include in scss-file:
@import "lib/foundation/scss/foundation";
- add next line to
- Use sass-globbing pluging, If you want to import whole directory in sass
- Install plugin
gem install sass-globbing
- Add line to build.sbt:
sassOptions in Assets ++= Seq("-r", "sass-globbing")
- Now you can import a tons of files
@import "styles/*";
or folders@import "styles/**/*";
- Plugin url: https://github.com/chriseppstein/sass-globbing
- Install plugin
Example of play-project in play-sass-example
folder
If u want to use compass just add next line in build.sbt
:
sassOptions in Assets ++= Seq("--compass", "-r", "compass")
- Cannot run program "sass": error=2, No such file or directory
- In linux: you should add path to sass command to environment variable $PATH
- Running from IntelliJ IDEA: your IDE doesn't read environment variables, you should set PATH to sass in IDE settings. Solutions and documentation: issue #6, Idea Help: path variables
- /var/lib/gems/1.9.1/gems/sass-3.4.2/lib/sass/util.rb:670:in `realpath': No such file or directory
ruby 1.9.1
+sass 3.4.2
may throw this error. Solution: uninstall sass and install sass 3.4.0