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
SCSS Breakpoint Variables #24
Comments
I usually use ones specific to the meaning. End-tablet, end-iphone, |
I agree that we should have an agreed upon naming convention for variables. A developer shouldn't have to be taught what your variable naming convention means or is before they begin working with your code. The naming convention should be something that any developer can pick up and run with without having to guess and the "reasons for and why" a naming convention was used. Making our variable naming convention more uniform for everyone to catch on to, understand, work with and update in the future is very important. |
I use the break6 - break12 normally there has also been sites that I have found with the starwars variables where I have just done my own sass because it would have taken to long to adapt those variables to what I was doing. so in conclusion I agree and the variables should be something you can get with just glance like: break6, break8, bp6, bp10, small, smallest. having a number in the name helps me a lot as well. |
@stephendelancey I like this idea, we could have a mixin where your variables are number based. So say you need a variable that is 768 you would do |
What if we just used break-xs, break-s, break-m, break-l, break-xl,
|
@Brockenstein @sylviakates |
I agree whole heartedly that any variable should not have obscure naming. This is poor practice and unprofessional. Our goal is to write clean code that anyone can go behind and maintain. Variables should be clearly defined. We don't all have to use $end-small for the last mobile break point however the variable should clearly define it's value. $end-mobile, $start-desktop, whatever. My vote is that our standards reflect the same sort of naming as we use for assets. |
I also agree with not using obscure variable names. On a maintenance perspective, it becomes more troublesome. The more standard we make them helps us out a bunch. Since there are so many sites to maintain keeping a standard helps us not to have to hunt down variable names to find out which break point is which every time we need to make a change. Like I currently know that around the 800px mark, that $end-small is most likely the variable used so I can just use that rather than always having to check. I always do a quick scan of the break point variables before I make updates but the standard ones are more descriptive and easier to remember while working in the code. |
I agree that all of our variables (not just breakpoints) should be named descriptively - just like we currently do for assets per the standards guide. This will make editing code after the initial build easy for any dev to understand. Anything we can do to make our code cleaner and help readability for any future dev maintaining it is a good idea. |
I agree with the rest of Pro Naming-Convention comments. I think it'll be easier if we're all on the same page with how we name things. The number-based naming (break-8, break-9, break-10 etc.) seems like it would be easier to remember as I'm typing css, however the description-based naming (small, medium large or end-mobile, start-desktop) is more descriptive. So either naming method makes sense to me! |
In my defense of unprofessional use of Star Wars naming conventions, the idea here was to abstract the name enough so that is not bound to any one particular size, as sizes are privy to change at the drop of hat. If we can come up with and agree upon naming conventions that do not target size or device, etc, I am all for it. But we would be doing same thing I did by using (fun) names, except just using standardized names. :-) |
Small, medium, large, etc, while descriptive, could be a problem. With so many devices on the market , what range of widths truly define these names? What if small suddenly needs to be a higher number? In the same way you should not be using presentational names in your CSS, the same can also be said for sizes, which could also be seen as presentational. Like the idea above about something a little more generic, like break-1, break-2, etc. |
Yes, @landerson1218, what we are creating is a common language for all of us to speak. |
@michaelspellacy I agree that our sizes should be flexible. I am fine with not naming it by device. But I am not understanding the issue with small medium large, or even adding in when needed mid-small. mid-large? It is unlikely that once you have started a project that you will need to be changing these variables. I understand that breakpoint sizes may fluctuate from site to site, but after you have set them in initial development how often will they change? We aren't requiring certain sizes per variable, just a naming convention that is easy to understand and add to and remember when working with the code. From my experience I have never needed more than 5 breakpoints variables, ideally I try to only do 3 breakpoint variables. There might be one off cases where you need to target on one specific item with a breakpoint that needs to be fixed at a certain size but not every breakpoint has to be a variable. I get your point that mobile isn't and won't always be 800px or less but so far current mobile devices, even devices with retina and high resolutions report back to the browser a lower resolution than what the screen is capable of displaying. For example, the iPad Air reports a screen size of 768x1024, like other iPads, even though its actual pixel count is 1536x2048. The Galaxy S4 reports 1/3 its actual pixel count. This allows us to continue to use min-width at in our breakpoints. now if you need to target a certain device then you could use min-device-width with the correct pixel ratio but we aren't talking about that. We are talking about making a naming convention that covers any size we need for the current project. And while I understand you are concerned about naming the variable tablet and that not variable not matching that device resolution but due to the fact that current devices report a lower number than actual screen resolution I don't think currently there is a large risk for this concern. If it does change, and all the sudden all mobile cell phones are now 640px instead of 320px and we have to change our code for that, then we can change our standards for that but I am betting by that point there will be a whole new set of media queries we will have to use so TMPs site will probably be redone to use those anyway, so the obscured variables probably won't help at that point because all the media queries will have to be built. I am not saying that a certain level of obscuring is not needed, because i do feel that the values of our variables should be able to be changed per site. Can you explain though the situations you have been in where sizes changed at the drop of a hat like you said where the super obscure variables you use helped? The only time I can think where all the sudden a desktop variable was no longer the needed variable was when I was using a variable of max width as my "desktop" size and they wanted the site to be wider after I had built it. I am not seeing how using your obscure variables would have helped me, I think I should have just not used the same variable for max width in my breakpoint. In fact if i had instead used small medium large as my breakpoint variables, left my max-width variable as max width and had the large variable the same size as the max-width variable, I could have added a new variable of extra-large and changed my max-width value to match that size. And then if I needed to fix any layout issues then I could have used the extra-large variable. But really, my css should have been good enough that increasing the max width shouldn't have required more variables anyway. You say that you want abstract names so that it is not bound to any one particular size but after you have used your Star Wars variables for so long, does your mind not start to say Luke is for mobile and deathstar is for desktop? So in the end isn't your obscuring doing the same thing as labeling them as mobile or tablet? Also what do you do when you need to add in a variable between luke and deathstar, if you add yoda into the middle of those two how do you remember that yoda is in between the other sizes? |
I am not sure why there would be a problem with using a common variable I did have to work with the Star Wars variables with the TMP site and they I think that sometimes trying to be to obscure in our variable naming I am not trying to hate on Star Wars with any of this, i just don't When thinking about a variable naming convention I think about being a new On Wed, May 25, 2016 at 7:27 PM, Brock Barnett notifications@github.com
|
I think what we should be focused on is the fact that we are only talking about setting a standard for the variables and not the pixel width that is set to them... They need to be descriptive, not generic, so that at a glance a developer that comes behind to update or fix issues they are able to quickly identify breakpoints without having to scroll up to the top of the SASS file every time they need to add a breakpoint. I believe we should use variables with names as x-small, small, medium, large, x-large and max-width. These are quick and simple and vague enough as to not be tied to a specific device like mobile or desktop, and the numbers do not need to be the same from one TB to the next. One TB may have a 400px x-small, and another will have a 550px x-small... The breakpoints variable amounts do not have to be the same, just the variable names need to be consistent from one TB to the next. We all need to keep in mind that once we finish building these TB that we have an awesome team of PSS devs that work day in and day out to continue to support the TBs we build. If they can not read our code, or have to make major changes to the code to fix an issue that arises down the road, that just takes more of their time away from other tickets and issues. |
My vote goes toward -- x-small, small, medium, large, x-large and max-width as well. Everyone recognizes these and they are not device specific. I have to agree with the others on obscure names. Since there is always the potential someone else may be maintaining and/or extending upon sites we build, I think the simpler the better for standard break-point variable names. Not being a Stars Wars fan, I would also have to constantly be referencing the actual sizes if variable names were being drawn from this movie and I was working on a maintenance ticket for that site. Nothing against that movie, it's just not within my preferred genre of films. |
I am in full agreement with the previous comments. Why make it more complicated? x-small, small, medium, large, x-large conveys the breakpoints at a level we can all understand easily and keeps it consistent. |
Guys, take it easy. LOL! I am all for what the majority wants here, as always, but try to understand why I did what I did before passing judgement (or calling such things bad practice or unprofessional). There are a dozen and half ways to do things in this business, but this is why we standardize. :-) Heck, even Chris Coyier, a fellow we all admire, has recommended abstracting breakpoint names. See https://css-tricks.com/naming-media-queries. Process played a role on a few of sites I have done in the past, especially our corporate site, in that I started before design was complete (as I tend to do to get a leg up when I can), so abstracting the names in this manner actually made development MUCH EASIER because the designs, especially on our corporate site, were a MOVING TARGET. Having something be "medium", only to have it change by a certain amount of pixels and bleed over into "large" territory, would mean having to change those breakpoints throughout my code from medium to large, etc. Not something I was keen on doing (especially if you have seen the corporate sites Sass) whenever a change in the design occurred. When you have a dozen breakpoints or more, small, medium, large, x-large, xx-large, xxx-small, etc. can be equally confusing. @jkmahoney While I can't speak for all developers, I do understand how my method could be confusing. My apologies if it was troublesome. It was an effort to save time and lessen confusion. What I did was print out the breakpoints and hang it next to my monitor for a quick ref throughout dev. After a couple of passes, it became very easy to commit them memory. I agree that having something easier to digest, especially for maintenance, is needed, so if the majority feel that using size is best, then that is fine. Will even change what I did on corporate to reflect the new standard we come up with. @Brockenstein , please create a draft and post it here for our review. Thanks! |
@michaelspellacy it is funny that you mention Chris Coyier because his article is actually one I read and I read a large portion of the comments before I even started this issue. Chris Coyier's method was still easily identifiable as to which variable was large than another one. And it sounds like based off of the comments here our team wants to do something similar with our breakpoint variables that is make them obscure yet also easily identifiable as being larger than the other. When I personally do breakpoints I think in min-width. So I am always thinking end of mobile do this end of tablet do this and once you have hit max width do this. That is why I have always been happy with end-small, mid-small and max-width. So please understand this will be difficult for me to adjust to as well but if it makes it easier for everyone then great. Looks like the most comment mentioned on is What do you guys think about if we need to add more after we have set these? What about if I need to add a smaller variable or a large variable? I think we should agree to NOT use the max-width variable in the breakpoint. As this variable is normally meant for the content wrapper and you may need to change your breakpoint or content wrapper size separate from one another. Also we have to ask the question, once we set this standard will it be required to update the default variables every single project or is it only an requirement if you are doing additional variables or until it is changed in the default code? Also we saw a couple of other breakpoints variable solutions I want to hear the teams reasons why we should go with them. I am going to mention another that was mentioned and actually why i don't think we should use it. I personally thought when using:
it could be used like Or if we do this is way:
We could do So please everyone tell me if you like xsmall, small, medium, large, xlarge and are cool with say mid-"first variable"-"second-variable" for your in betweens such as mid-large-xlarge and if you need to add more doing xxsmall or xxlarge. meaning default wise we would see possibly seeing this often This would be mean you could potentially have : I have to be honest if you are using 13 breakpoints I have to question what you are doing. |
I am fine with the naming convention you are proposing, Brock. We could I also concur with you on using an absurd amount of breakpoints. I normally On Fri, May 27, 2016 at 8:59 PM, Brock Barnett notifications@github.com
|
Depends on the design. The more intricate the design is, the more breakpoints you have. Often, you can tell a good responsive design from a bad one by the amount of breakpoints that are present. It's a pretty good gauge. :-) |
Or you could be really bad at RWD, so maybe not! :-) |
@Brockenstein Any progress on coming closer to a finalized standard we can add to our documentation? |
@michaelspellacy It's been 9 days since I emailed out the devs and it looks like we are good with the following.
More than likely common breakpoints will be
The suggested sizes below would just be what we put in the default code and would be perfectly acceptable for each developers on each project to change, maybe in the default sass the sizes could be:
If you needed additional Media queries you could do If for some reason you need a range of variables for a specific section of your site you could add a name to the variables if the above options just aren’t enough like the following:
and so forth. Before we put in a ticket to change this for the default code, I suggest we agree on a mixin and get both of those in, especially since we don't want the mixin we use make us rethink our variables. |
So, we never resolved this. I came across an interesting article today. I think the author's thoughts fit in well with what we are attempting to do in adopting a standard/naming convention. Give it a read and let me all know what you think: https://medium.freecodecamp.com/the-100-correct-way-to-do-css-breakpoints-88d6a5ba1862 |
@michaelspellacy O i thought we had agreed but like I said no ticket has been made due to no mixin chosen yet. I have gone ahead and been using
I read the article and it seems to go against your idea on obscuring and not being device specific which is why we landed on the variables I just mentioned. Are you changing your viewpoint on this? I personally don't care for the way he uses his breakpoints. One of the comments from others says "Ideally you want to choose your breakpoints around your content and design, not around devices." Which I tend to agree with. When I think responsive I think a perfectly flowing site. Not a site with few break points just for devices. After all even on a table for phone someone can pull up two windows side by side halfing their resolution of their device. So you never know how people will use it. |
@Brockenstein This is pretty much how we are all doing it now. Will add to standards doc. Finally! |
I was asked by the Louisville team to add this to standards.
Currently we are generally using
$mid-small, $end-small, $max-width
Which I find I rarely need more than these 3 but the questions comes into if you need more variables what should they be called? I know I have added $smallest and $mid-max before but really we should have a naming convention.
We have see several other options such as, break6 for min width of 600px then break8 for min width of 800px and so on. Also we have seen, Mobile, Tablet, Desktop. or Smallest, Small, Middle, Large, Largest. We have also seen phone-s, phone, tablet-s, tablet, tablet-l, desk.
After reading some articles and so many different developers commenting on their way of doing it. I am leaning towards the thought of why make it confusing by obscuring? Ultimately If you are going to obscure your breakpoint sizes make sure that it is something people can understand like wrist, palm, lap, desk, wall, mall you obviously know that palm is smaller than desk.
Some confusing obscuring examples are Homer, Marge, Bart, Lisa, Maggie or the current favorite of some of our developers. Death star, Luke, Leia, etc. While doing these may be fun, let me tell you, they are hell to work with when you aren't the developer who originally wrote them. Several of the developers have complained about not understanding why one variable is larger than the other.
For this reason we should decide on a naming convention. I will create another issue for the mixin.
The text was updated successfully, but these errors were encountered: