Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function styleSheetText of scalatags.stylesheet.StyleSheet class is not functioning well. #33

Open
Cloudius opened this issue Aug 21, 2018 · 1 comment

Comments

@Cloudius
Copy link

When calling styleSheetText, e.g. to generated a <style> element, this function gives an empty String while when applied in a non ScalaFiddle environment this function works.
In a server-based (JVM) and a standalone Scala.js client application the style text is right generated.

An example is found here -template adjusted- with a working work around (hand-made css). By commenting out the overridden styleSheetText function the desired situation is achieved.
However in ScalaFiddle there is no style text put between the tags.

Findings:

  1. In ScalaFiddle the function styleSheetText returns an empty String.
  2. Well generated style code will be generated all other environments.
  3. In all cases the class attributes are generated well
  4. The internal allClasses member of the scalatags.stylesheet.StyleSheet returns a empty List in the ScalaFiddle case, while in other case a non-empty List will be returned.
  5. This indicates that the internal allClasses0 must be (re-)set to Some(() => sourceClasses.value(this))

I hope the problem will be recognized, so an solution should be possible soon.

@ochrons
Copy link
Collaborator

ochrons commented Aug 21, 2018

The macro that generates the list of classes doesn't seem to work properly in ScalaFiddle (hard to say why). A quick workaround is to manually list your CSS classes like this,

    override def styleSheetText = 
      List(cell, strong, table).map(_.structure.stringify(Nil)).mkString("\n")  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants