csstyle icon indicating copy to clipboard operation
csstyle copied to clipboard

considering removing locations

Open geddski opened this issue 9 years ago • 12 comments

After some great feedback from Paul Irish and a lot of brainstorming, I think we could probably remove locations entirely. Locations' purpose are to allow consumers of a component to override aspects of the component when it's being used in a certain context. It's a common use case and csstyle needs to support it. Locations have a couple of problems however:

  1. Because they use id they automatically override every part of component, including its options. So if you wanted to override the base style of a component using a location but leave it alone when it's using an option, you're out of luck.
  2. People start using locations in places where they really should be using a component.
  3. There are a lot of semantics to remember with components, parts, options, tweaks, & locations.

I think components themselves provide enough context:

@include component(sidebar){
  @include component(button){
    // override some aspect of button when inside sidebar
  }
}

And they do this with a single class name rather than an id. The only problem with this is that options and parts also only add a single class name. This would lead to load-order importance which is something csstyle is supposed to handle for you. One option would be to have csstyle add another class onto the parts & options selectors that get generated so that they are automatically more specific than the base styles applied to a component inside of another component.

I'm open to ideas and feedback before making a breaking change like this.

geddski avatar Feb 14 '15 04:02 geddski

I don't think they are really needed. The use cases can easily be achieved in other ways, like a simple option for some custom page that is a little different.

robclancy avatar Feb 28 '15 12:02 robclancy

+1

ebrentnelson avatar Mar 19 '15 20:03 ebrentnelson

+1 for anything that anything that drops using id.

stinoga avatar Mar 19 '15 21:03 stinoga

Planning on removing locations. @stinoga the id will still be used for tweaks, unless we can think of some other clever way to make them automatically override any level of nested components/parts/options.

geddski avatar Apr 03 '15 07:04 geddski

@geddski If you are still thinking of removing @locations, maybe you should do so before too many people marry themselves to it. Or at least remove it from the http://csstyle.io page to discourage it's use. Thoughts?

jesseleite avatar May 20 '15 21:05 jesseleite

+1

simonj avatar Aug 22 '15 17:08 simonj

that is a good idea. I'll remove it from the docs and tests to start.

geddski avatar Sep 02 '15 17:09 geddski

He's alive!

jesseleite avatar Sep 02 '15 18:09 jesseleite

@JesseLeite indubitably :)

geddski avatar Sep 02 '15 19:09 geddski

http://www.csstyle.io/ updated to remove locations.

geddski avatar Sep 02 '15 19:09 geddski

Good job @geddski !

simonj avatar Sep 03 '15 16:09 simonj

This should be closed, right :)?

FWSimon avatar Nov 04 '15 14:11 FWSimon