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

Abandon StyleC #48

Closed
japgolly opened this issue Jun 12, 2015 · 9 comments
Closed

Abandon StyleC #48

japgolly opened this issue Jun 12, 2015 · 9 comments

Comments

@japgolly
Copy link
Owner

It might be time to go back to the drawing board for StyleC. I barely use it and I was its biggest proponent. Does anyone else use it?

Similar to the Router situation in scalajs-react, it might be better to trade-in a little safety for a much larger portion of usability and Scala-friendliness. Would also allow us to drop the Shapeless dependency.

@japgolly japgolly added the maybe label Jun 12, 2015
@chandu0101
Copy link

i never used it , +1 from me :)

@japgolly
Copy link
Owner Author

Thanks @chandu0101 - the more feedback and voices heard the better.

It's sorta sucks because it actually does address the requirements it was intended for - the problem is it's just a bit fiddly/annoying/alien to use. Might be better to replace it with something based on plain Scala case classes or something.

@matthughes
Copy link

My motivation for using it to be able to skin a component (that represents more than one element).

For example, I have a SearchBar that has a structure something like this:

div(wrapperStyle,
  span(/*magnifying glass icon*/, iconStyle),
  input(`type` := text, inputStyle)
)

I'd like my component to provide a default skin (defined styles for wrapper, icon, and input) but also allow the caller to pass in a custom style set via Props. styleC doesn't really serve this purpose or at least I don't see how it could. What would the type of my style be in Props, just StyleC? It would need to be parametrized so the caller knew they needed to pass in three styles.

@LMnet
Copy link

LMnet commented Jun 23, 2015

For me styleC is the most complicated and unclear feature - because of the terrible usage syntax. I understand that this conception may be usefull sometimes, but it creates a lot of syntax noise in the code.

Also, in the most cases I need unsafeChild. I just want to have some css hierarchy without restrictions. In standalone styles I can use & to create nested styles, and this & symbol creates less amount of syntax noise than unsafeChild.

So, my proposal - remove styleC and rename unsafeChild to &. If it will help to remove such huge lib as shapeless it would be really cool!

@joprice
Copy link
Contributor

joprice commented Nov 25, 2015

I started with it and ended up ripping it out and prefixing groups of styles. Dropping the shapeless dependency is also a plus for code size.

@japgolly
Copy link
Owner Author

Yeah same. Will definitely do this (and other work) but it will have to
wait around 2 months unfortunately.

On 25 November 2015 at 13:10, Joseph Price [email protected] wrote:

I started with it and ended up ripping it out and prefixing groups of
styles. Dropping the shapeless dependency is also a plus for code size.


Reply to this email directly or view it on GitHub
#48 (comment).

@japgolly japgolly removed the maybe label Dec 25, 2015
@japgolly japgolly changed the title Abandon StyleC? Abandon StyleC Dec 25, 2015
joprice added a commit to joprice/scalacss that referenced this issue Jan 17, 2016
@japgolly
Copy link
Owner Author

The StyleC experiment was meant to address the following:

  1. A logical/composite style (eg a style for an entire widget) can have multiple CSS styles that need to be applied.
  2. Adding a new sub-style to a composite style should result in a compilation error in all places that you don't update to use the new sub-style.
  3. Styles all have the same type. Adding/removing/reordering sub-styles shouldn't result in silent undetectable errors where the sub-style ends up being applied to the wrong part of HTML.

StyleC does actually solve those things. It's just a horrible pain in the ass to use. Anyway, a replacement will need to at least consider the above goals with the additional goal that it not be horrible to use.

@japgolly
Copy link
Owner Author

Screw it - I'll just remove it without replacement in 0.4.0. No one likes it, I don't think anyone uses it (except me and only in one place). I'd normally deprecate it and offer a replacement but I think this time it'll be better just to get Shapeless off the classpath.

@japgolly
Copy link
Owner Author

Closed via #48. New ticket #71 to find a replacement.

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

5 participants