The first thing you'll want to do is import some settings by using one of these
import scalacss.DevDefaults._ // Always use dev settings import scalacss.ProdDefaults._ // Always use prod settings // This will choose between dev/prod depending on your scalac `-Xelide-below` setting val CssSettings = scalacss.devOrProdDefaults import CssSettings._
This provides two sets of sensible settings: development and production.
|Style conflicts||Keep both sides of conflict.
|Keep both sides of conflict.|
|Error handling||Print to
|Class name generation||
Indents, spaces, newlines.
Defaults will choose a mode to use based on its
devMode: Boolean method
to determine production-mode.
For instance, in my production SBT settings I generally have:
// Prod settings scalacOptions ++= Seq("-Xelide-below", "OFF")
-Xelide-below OFF doesn't turn eliding off, it means "elide everything". There must've been painting going on in the building with no windows open when that was named.
Defaults aren't mandatory, you're free to customise as needed. (See DefaultSettings.scala.)
Styles, attributes, values, nearly everything in ScalaCSS is immutable.
When you're declaring a large module of styles, it's very inconvenient to have
to manually collate all styles you declare.
mutable.StyleSheet exists for this purpose. Subclass it, create your styles
and they will be registered automatically so that you can turn them all into
CSS at once.
Stylesheets come in two different flavours: standalone and inline.
|Purpose||Generating a CSS file.||Styling in a Scala or Scala.JS webapp.|
You need to specify.
Generated when not provided.
|Usable style types||Static only:
|Return type after creation||Unit||
To create a style module,