These are chat archives for japgolly/scalacss

2nd
Jun 2015
Chandra Sekhar Kode
@chandu0101
Jun 02 2015 07:02

@japgolly

 GlobalRegistry.register(
      GlobalStyle,
      NavMenu.Style,
    HomePage.Style)
    GlobalRegistry.onRegistration(_.addToDocument())

do you see something wrong here ?

as it creates new style tag for each component registration :s
Chandra Sekhar Kode
@chandu0101
Jun 02 2015 07:16
it looks like there is a contraint
IE. :) They had a limit on 31 stylesheets at one point, and a max limit on the number of selectors allowed in a stylesheet. If you imported things with @import you could only do so 31 at a time per level or something.
I have hit that limit before, in a framework that pretty much gave every component/widget its own stylesheet and some of those created their own dynamic style tags on the fly.
<AMcBain> We ended up cheating by sharing the same dynamic style tag across all that needed it.
<AMcBain> Version 3 of the framework changed approaches so we're not even close to the limit anymore.
Matt Hughes
@matthughes
Jun 02 2015 21:12
I’m working on breaking down my one massive InlineStylesheet into roughly one per component. Problem is, when giving names to style() (which is essential IMO if you want to track down errors), you risk having the same name across different stylesheets.
Was thinking it would be nice if InlineStylesheet had a def prefix: String method that would be prepended to all style names if given.
Otto Chrons
@ochrons
Jun 02 2015 21:13
you can always derive your own InlineStylesheet and add the functionality?
it does sound sensible to me, so maybe make a PR :)
Matt Hughes
@matthughes
Jun 02 2015 21:20
ya, this is what I wrote
trait NamedInlineStyleSheet extends StyleSheet.Inline {
  import scalacss.DslBase.ToStyle
  import scalacss.Compose
  override protected def style(className: String = null)(t: ToStyle*)(implicit c: Compose): StyleA = super.style(prefix + "-" + className)(t: _*)(c)

  def prefix: String = getClass.getSimpleName
}
Otto Chrons
@ochrons
Jun 02 2015 21:22
anyone done ScalaCSS wrapper for Semantic-UI? :)
Chandra Sekhar Kode
@chandu0101
Jun 02 2015 23:32

@matthughes i believe #35 will take care of this!, when its done :)

I’m working on breaking down my one massive InlineStylesheet into roughly one per component

+1