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

Optional colons in Sass? #228

Closed
mahemoff opened this issue Dec 19, 2011 · 15 comments
Closed

Optional colons in Sass? #228

mahemoff opened this issue Dec 19, 2011 · 15 comments

Comments

@mahemoff
Copy link

Is there any possibility of making the colons options in Sass syntax, as in:

body
  background red

I've used the same in Stylus and appreciate the DRYness of it.

@chriseppstein
Copy link

dear god. no.

@mahemoff
Copy link
Author

? Any rationale or just a question of taste? For the record, I constantly
forget to add the colons as I'm used to dropping 3 things from regular CSS
( {} ; : ) and it seems very arbitrary to me that this syntax drops two of
the three.

On Tue, Jan 10, 2012 at 4:37 PM, Chris Eppstein <
reply@reply.github.com

wrote:

dear god. no.


Reply to this email directly or view it on GitHub:
#228 (comment)

  • Sent from my web browser

@chriseppstein
Copy link

I think it makes things very hard to read without syntax highlighting.

@nex3
Copy link
Contributor

nex3 commented Feb 10, 2012

I agree with Chris here. The lack of colons make it very difficult to tell properties apart from selectors at a glance.

@bwiklund
Copy link

bwiklund commented Apr 4, 2014

Sorry to bump an old topic, but seriously? Do you guys not use a text editor with syntax coloring?

I know people who roll their eyes when they find out I use sass and not scss. But the colon is a completely reduntant bit of cruft, why not let people who don't want it drop it?

@nex3
Copy link
Contributor

nex3 commented Apr 4, 2014

Not everyone uses syntax highlighting, not everyone's editor has Sass highlighting available, and not every Sass highlighting package is configured in such a way as to make this pattern in particular readable. It's our job to design syntax that's broadly useful, not syntax that uses a minimal number of characters.

@arxpoetica
Copy link

There's a very solid workaround to the "very hard to read" argument.

Can it be an optional thing? The nice (truly, truly wonderful) thing about Stylus is that it doesn't enforce either. You can be as slim or as verbose as you want. It doesn't have an opinion. You can use colons if you want or not; entirely up to taste/need. That is a happy medium. If you work in an editor that hates syntax highlighting, use colons. If you're using something that highlights, no need.

@nex3 I understand your comment about editors, so this scenario (optional colons) addresses both needs.

Why would anyone not want colons? I've worked in both SASS and Stylus extensively, and hands down, the non-colon option is the winner in my book. It's easier to type, just as easy to read (in the right editor, see embeds). But there's an actual additional reason. When using Jade or Slim hand in hand, it becomes even easier to copy back and forth from a .jade or .slim file and a .sass file. Because the syntax is identical. Colons just add noise in that specific scenario. This is an experiential thing, and I realize not everyone will care about that, but it's optimal for some people, and OPTIONAL syntax is a win-win for everyone.

Side note, for those who do use contextual highlighting editors, they do scan the same:

image

It would be nice for this issue to get some more serious consideration, not just based on preference. I've tried to present the pros in a way that works for everyone.

Update/Aside: I updated my comment to be more pleasant. This is something I would actually love to see implemented, and would absolutely be valuable, so I'm trying to make the case instead of just expressing sentiment.

@tristan-mcdonald
Copy link

I'll chip in for optional colons. I've used Stylus for the last few years and need to move over to Sass now, and I agree with all of the points @arxpoetica makes.

A further argument, though at first it seems trivial, it that this would save at least hundreds of key presses per day for people who write CSS all day like myself. I hope to be working for the next 35 years and have basically resigned myself to having arthritis as I get older, (as we all likely will) but even removing a few hundred key presses per day could help reduce that slightly over time.

Anyway, I prefer setting the text editor to colourise text and do the work for me, so it would be great if removing colons was an option.

@ArmorDarks
Copy link

ArmorDarks commented Jul 20, 2017

I'd opt for optional colons not only in Sass, but SCSS files as well.

Honestly, I don't see how lack of colons introduce any readability issues. They are needed only for single-lined selectors with multiple properties, otherwise newline can serve as quite strong indicator of statement end.

I wonder, how do we live with ES6 where semicolons finally optional and never had that issue with readability. JavaScript without colons is a bliss. I passionately hated colons from the day 1 when I started to learn JavaScript, and hate them in CSS. If not linters, I would continue to constantly forget to place them and break my code. I'm sure I'm not the only one.

@mesqueeb
Copy link

mesqueeb commented Sep 22, 2019

Whether a developer finds it harder to read css with colons / brackets / semi-colons is just a personal opinion. I believe each developer should be able to choose which ones he/she leaves out in their code.

Stylus allows any variation of which ones of colons / brackets / semi-colons are used or not used.

It would be great if Sass could do this as well! No reason to arbitrarily choose just the latter two! 😉

@nikkwong
Copy link

Is it possible to ever include this? Or the developers just don't like the idea? I hate colons.

@Awjin
Copy link
Contributor

Awjin commented Jun 30, 2021

This is not something we ever intend to add. Since Sass is designed as a superset of CSS, we try to avoid making changes to basic CSS syntax, or adding different style options that make Sass files look different from each other.

@tristan-mcdonald

This comment has been minimized.

@fershopls

This comment has been minimized.

@roj1512

This comment has been minimized.

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