News for hackers. Stuff that matters.
Re:I can style a whole app with only four hex values and SASS. by damoncali on Wednesday May 02, 2012 @11:32PM (#3922268)
Serious question - am I the only one who has looked at SASS and all its whizbang features, and decided that plain old CSS is just fine?
Re:I can style a whole app with only four hex values and SASS. by ryanflorence on Thursday May 03, 2012 @12:06AM (#3922333)
I hate to pull the "you must work on trivial projects" card, but really, this article points out one very solid reason to use a CSS pre-processor. If you've never felt the pain of managing the colors, with gradients and everything else, I'm not convinced you've worked on a decent-sized project--that or you love project search/replace.

Try out the SCSS syntax (or LESS), might warm you up to it a bit more.

Re:I can style a whole app with only four hex values and SASS. by damoncali on Thursday May 03, 2012 @12:17AM (#3922358)
Trivial projets? Perhaps. How many layouts does one need before a project becomes decent-sized? In the several years I've been doing web development professionally, I've changed the colors on a site exactly zero times - it just never comes up. I have wished for variables in CSS from time to time to make things more readable, but really not enough to care about SASS.

In the end I find that if I organize my CSS well, changing things like colors really isn't such a big deal. Like you say. Find/Replace.

Oh well. Either it will pass as a fad or I will one day be forced into the light.

Re:I can style a whole app with only four hex values and SASS. by shuzchen on Thursday May 03, 2012 @02:41AM (#3922680)
Perhaps it's the type of design projects that are undertaken and the work style of the designer.

In the situations where a designer provided .psds for me to transform into html/css, no I haven't had to modify anything. But then, the iteration on the design happens with the other guy, and he does it in photoshop. If a change happens, he just sends me the new asset images, and I just replace them in the repo.

The times where I'm the one doing the design work, I end up switching things up a lot. This is because I don't do my design work in photoshop, but rather in the browser with actual html/css. So even while I'm iterating on something by myself (before having even shown the client anything), I'll switch colors up constantly trying to get something I'm okay with.

Re:I can style a whole app with only four hex values and SASS. by karlshea on Thursday May 03, 2012 @01:36AM (#3922502)
As nice as the colors are, the value I find in CSS preprocessors is the nested rule syntax and being able to use math and variables.

I strongly advocate giving the SCSS version a try. It's straight-up CSS with all the things that should have been there in the first place.

Re:I can style a whole app with only four hex values and SASS. by papalalu on Thursday May 03, 2012 @07:29AM (#3923273)
It's not just something like changing colours, though i have had to do that - it's applying the colours in the first place.

Rather than trying to remember a previous hex, or looking it up, you can think ok, this should be the darker highlight colour - and as you say, looking later you know which colour that is.

It's not just colours - a good example is a clearfix. Rather than add it to the markup, you can add it via css, and of course if you change it, you change it once.

Re:I can style a whole app with only four hex values and SASS. by mattwdelong on Wednesday May 02, 2012 @11:45PM (#3922297)
I agree. Though, I would love if someone responded and convinced me otherwise. What am I missing?
Re:I can style a whole app with only four hex values and SASS. by shuzchen on Thursday May 03, 2012 @02:35AM (#3922664)
If you've ever had to go back to your CSS and redo the colors (client wanted red instead of blue) then you'll find yourself thinking "I wish I could just store these redundant values in one place". At that point you'll start looking at css preprocessors. A simple find/replace doesn't always cut it (I want these things red, keep these other things blue), especially if your design also has derivative values (used in gradients, shadows).

Personally, while I do try to take advantage of all the features of LESS, I think the biggest thing is the ability to define macros (utilizing mixins or functions). Never again do I need to write multiple rules for one style (-moz-foo, -webkit-foo, and foo) or need to remember the complicated argument order (defining gradients is vastly different between all of them).

The cost is in introducing a compile step, but the benefit is that your stylesheet becomes easy to write, easy to read, easy to modify.

Re:I can style a whole app with only four hex values and SASS. by damoncali on Thursday May 03, 2012 @10:36AM (#3924003)
Just curious - is there a reason CSS can't incorporate variables/macros and basic math without having to resort to a preprocessor? When CSS 5 or whatever is released, will all of this just be known as CSS?
Re:I can style a whole app with only four hex values and SASS. by arocks on Thursday May 03, 2012 @03:19AM (#3922757)
I think SASS is great for reusing pages or styles within or across projects. If a website has color-coded areas, say like The Guardian[1], then using color variables as the OP mentioned would make it extremely trivial to reuse.

The math behind layouts can also be set using variables reducing a lot of headaches while the client wants 'the left column could be a bit wider'.

I agree that it requires a lot more coding discipline than plain 'ol CSS. So much to the extent that one would be tempted to abandon it. But like all good layers of abstractions, it reduces a lot of effort in the future.

[1]: http://www.guardian.co.uk/

Re:I can style a whole app with only four hex values and SASS. by mgkimsal on Wednesday May 02, 2012 @11:43PM (#3922290)
no, you're not the only one.