These are chat archives for japgolly/scalacss

4th
Jun 2015
Matt Hughes
@matthughes
Jun 04 2015 14:32
Anyone use styleC successfully? I tried copying the basic example from the docs, but can’t get it to compile:
Ah looks like this is an outstanding issue. Just need to add an import to the callsite: 24
#24
that fixed
Matt Hughes
@matthughes
Jun 04 2015 15:29
Any thoughts on adding a new helper method trustedOverride?
  val styleFoo = style(
    paddingLeft(1 px),
    paddingRight(5 px)
  )

  val styleWithOverridesNow = style(
    backgroundColor.blue,

    style(
      styleFoo,
      paddingRight(10 px)
    )(Compose.trust)
  )

  val styleWithOverridesHelper = style(
    backgroundColor.blue,

    trustedStyle(
      styleFoo,
      paddingRight(10 px)
    )
  )
the last two styles are semantically identical. trustedStyle would just be a shortcut for the style()(Compose.trust) method.
Idea is I want to localize my trust to just the set of attributes I know I want to override. That way, if styleFoo later adds a backgroundColor, I will get a warning during dev and either address it or move into my trustedStyle.
Matt Hughes
@matthughes
Jun 04 2015 16:26
Is this how folks are doing partial overrides?
Matt Hughes
@matthughes
Jun 04 2015 17:31
@ochrons Is your SPA build set up for dev/prod settings with ScalaCSS?
Otto Chrons
@ochrons
Jun 04 2015 17:32
hm, don't know, probably not if it's a 0.2.0 feature
Matt Hughes
@matthughes
Jun 04 2015 17:33
object DevDefaults extends DevDefaults
trait DevDefaults extends IDefaults {
  override          val registerNameGen     : NameGen          = NameGen.numbered()
  override          val registerErrorHandler: ErrorHandler     = ErrorHandler.noisy
  override implicit def stringRenderer      : Renderer[String] = StringRenderer.defaultPretty
  override implicit def composition         : Compose          = Compose.safe
}

/**
 * Production-mode defaults. Minimised CSS, no warnings.
 */
object ProdDefaults extends ProdDefaults
trait ProdDefaults extends IDefaults {
  override          def registerNameGen     : NameGen          = NameGen.short()
  override          val registerErrorHandler: ErrorHandler     = ErrorHandler.silent
  override implicit def stringRenderer      : Renderer[String] = StringRenderer.formatTiny
  override implicit def composition         : Compose          = Compose.trust
}
It’s basically toggling between those two. Not sure how you would implement though. elidable to the rescue?
Otto Chrons
@ochrons
Jun 04 2015 17:47
nothing in the docs? I haven't really looked into CSS stuff lately
Matt Hughes
@matthughes
Jun 04 2015 17:48
Well it’s a compile time decision. Only way I know how to do that is using something like elidable, which I hadn’t heard about since I started using ScalaJS.
Otto Chrons
@ochrons
Jun 04 2015 18:22
probably elidable then