So I've been messing with SASS for a few days now and it is amazing.
If you don't already use it for your CSS then you're missing out - SASS will enable you to save time both in terms of creating and editing your CSS, plus it just feels right when you're coding.
Chris's awesome video (go to Videos on here) all about Codekit is uber helpful so I'd recommend you view it, but for those getting into or already using it, I figured a snippets thread would come in handy.
So here are some snippets I've made for my workflow, with instructions on how to use them in your .scss files that will output all the CSS you need. The added benefit is that you won't even need to worry about vendor prefixes, it's all taken care of in the mixin.
Just copy paste and then use the examples within your SASS.
--> Transitions Mixin
@mixin transition($transition-property, $transition-time, $method) { -webkit-transition: $transition-property $transition-time $method; -moz-transition: $transition-property $transition-time $method; -ms-transition: $transition-property $transition-time $method; -o-transition: $transition-property $transition-time $method; transition: $transition-property $transition-time $method; } /* Usage - Stick into the top of your SCSS sheet and @include where needed for cross browser transitions.
$transition-property = the property you want to transition $transition-time = seconds you want the transition to last $method = how you want it to transition - e.g. ease-in-out
This is genius. Expect me to contribute as soon as I got my Mac set up again this week (thanks to Chris' video on Codekit, I realized that software vendors don't care about Windows users much and that the best development software is Mac only)! ;)
I've been learning LESS and it seems very similar to SASS, but so far from your examples it seems like a little less work in that I don't need to use "@mixin" or "@include". LESS's version of a mixin is just like another class name which you add inline, so something like this (borrowing from your first example):
@transition-property = the property you want to transition @transition-time = seconds you want the transition to last @method = how you want it to transition - e.g. ease-in-out
Personally I think that they both do an awesome job and are very similar with regard to mixins, variables etc.
There has been some assumption that SASS requires Ruby on the server to process but just like LESS it can be pre-processed and uploaded as traditional CSS.
One thing that isn't mentioned above is how to handle the same item in a nested list. For example, defining the style for a link with different states or classes:
@mottie - pretty much the same format, one handy trick I learned is you can also chain them, so if your link/visited pseudo or hover/active's are the same;
@chriscoyier - I also have COMPASS but my understanding is that it comes with a lot of stuff - similar to other bootstraps I don't find it super appealing because I spend alot of time battling with and trying to understand another persons code rather than having full 100% control from start to finish. Though I think longtime you're probably right that having a core base is the best way forward.
@joshwhite - It's definitely worth it, I've been running 4 projects simultaneously and finally just forced myself to use it. I actually started by going back into a small site that I was making and rewriting the CSS into SASS - trial and error for the win.
SASS definitely seems cooler (due to compass) than LESS, based on the information I've gathered.
@joshuanhibbert@andy_unleash it should probably be called "Get good at Git". People use the word Github like it's a thing on it's own :p After some time, I'd say I'm pretty comfortable with Git now. If any of you need some help setting it up or understanding what exactly is going on I'm sure I could help.
Didn't Chris do a let's suck at Github together? :) I'd join that conversation - I'd love to have something in place that didn't rely on subversion.
Sigh... one more thing to add to the pile. I still need to sit down and dedicate some time to learning javascript/jquery. I continually feel like what I'm doing right now is probably the most inefficient way to do it that exists :)
So, like I said, I planned on going back to Mac because CodeKit has no Windows version. However, I looked a little further ahead and noticed that with Compass.app, I got all I need.
No Ruby needed, no other funky stuff it seems. Took me a couple of hours to figure out which is what and what is where, but now I think I got it down.
I'll write up a blog post about this later this weekend, in case people want to give it a shot.
Hey guys....so from experience, I know about the learning curve and threshold that SASS may have for Windows users. A couple of times I wanted to start with SASS and once I saw Ruby and command line and whatnot, I gave up already. Not sure if that's just me or a general PC user problem.
@Senff Honestly, having a Ruby dependency is why I shied away from SASS.
I looked into LESS, which has a very similar format, and it just uses javascript to parse the LESS into true css - with some online sites to do it for you (I shared the links above). I know it won't work if the user turns off javascript, but as I said, it's so similar to SASS that you could convert it without too much effort.
@Mottie : that's the point of my article -- there is no Ruby dependency for the user at all! With Compass.app, it's amazingly simple.
(Well, under the hood it's Ruby, but you won't have to deal with it.)
I did look into LESS but it came with a few too many things where I was put off ("The easiest way to install LESS on the server, is via npm, the node package manager" is one of them! I don't want to deal with NPMs. Ha!)
Anyways, I've chosen SASS as my weapon of choice for the time being, glad to see that Chris' "SASS vs LESS" article favors it too.
@Senff, thank you for your article, and I think it's a good tutorial on getting up and running quickly! I don't think Sass is that hard to get running on Windows with Ruby, though. You can use the Rails Installer. It will install everything you need, and to get Sass running you just have to run a few commands, and that's all.
an alternative to Compass is Bourbon
it even has a layout system, similar to Susy called Neat
Just a follow up on my previous post: still using SCSS. It's completely changed how I write CSS. I use generally use Compass through the Terminal (don't use Codekit, stopped using LiveReload). We've even built it into our basic framework.
If you don't already use it for your CSS then you're missing out - SASS will enable you to save time both in terms of creating and editing your CSS, plus it just feels right when you're coding.
Chris's awesome video (go to Videos on here) all about Codekit is uber helpful so I'd recommend you view it, but for those getting into or already using it, I figured a snippets thread would come in handy.
So here are some snippets I've made for my workflow, with instructions on how to use them in your .scss files that will output all the CSS you need. The added benefit is that you won't even need to worry about vendor prefixes, it's all taken care of in the mixin.
Just copy paste and then use the examples within your SASS.
--> Transitions Mixin
--> Gradients Mixin
I've been learning LESS and it seems very similar to SASS, but so far from your examples it seems like a little less work in that I don't need to use "@mixin" or "@include". LESS's version of a mixin is just like another class name which you add inline, so something like this (borrowing from your first example):
I believe it also doesn't need Ruby to be running on your Windows Machine - so you don't even need to worry.
I personally hate the command line - GUI's were invented for a reason (to make boring stuff pretty and user friendly) so apps like this are awesome.
I've created a repo with some branches here https://github.com/andyunleashed/Fun-with-SASS-LESS
Might be good to add as we go.
Just wondering, any advantages to using SASS over LESS?
Personally I think that they both do an awesome job and are very similar with regard to mixins, variables etc.
There has been some assumption that SASS requires Ruby on the server to process but just like LESS it can be pre-processed and uploaded as traditional CSS.
One thing that isn't mentioned above is how to handle the same item in a nested list. For example, defining the style for a link with different states or classes:I believe SASS and LESS use this same format.
A couple more mixins:
@johhuanhibbert - Absolutely, because I am terrible at it!
@joshwhite - It's definitely worth it, I've been running 4 projects simultaneously and finally just forced myself to use it. I actually started by going back into a small site that I was making and rewriting the CSS into SASS - trial and error for the win.
@joshuanhibbert @andy_unleash it should probably be called "Get good at Git". People use the word Github like it's a thing on it's own :p
After some time, I'd say I'm pretty comfortable with Git now. If any of you need some help setting it up or understanding what exactly is going on I'm sure I could help.
Any know any good tutorials?
Sigh... one more thing to add to the pile. I still need to sit down and dedicate some time to learning javascript/jquery. I continually feel like what I'm doing right now is probably the most inefficient way to do it that exists :)
No Ruby needed, no other funky stuff it seems. Took me a couple of hours to figure out which is what and what is where, but now I think I got it down.
I'll write up a blog post about this later this weekend, in case people want to give it a shot.
But, I kept going and I'm a happy SASSer now, thanks to Compass.app, so if you're on Windows and you need to get things going, check out my (hopefully) helpful 5-step instructions: http://www.senff.com/front-end/coding-tips/getting-started-with-sass-on-windows-the-easy-way/
I looked into LESS, which has a very similar format, and it just uses javascript to parse the LESS into true css - with some online sites to do it for you (I shared the links above). I know it won't work if the user turns off javascript, but as I said, it's so similar to SASS that you could convert it without too much effort.
(Well, under the hood it's Ruby, but you won't have to deal with it.)
I did look into LESS but it came with a few too many things where I was put off ("The easiest way to install LESS on the server, is via npm, the node package manager" is one of them! I don't want to deal with NPMs. Ha!)
Anyways, I've chosen SASS as my weapon of choice for the time being, glad to see that Chris' "SASS vs LESS" article favors it too.
-moz-border-radius-bottomleft:5px; -moz-border-radius-bottomright:5px;
@mixin rounded_symmetrical($vert, $radius: 10px) { border-#{$vert}-left-radius: $radius; border-#{$vert}-right-radius: $radius; -moz-border-radius-#{$vert}left: $radius; -moz-border-radius-#{$vert}right: $radius; -webkit-border-#{$vert}-left-radius: $radius; -webkit-border-#{$vert}-right-radius: $radius; }
.user-settings { @include rounded_symmetrical(bottom, 5px); }
awesome, nice stuff everyone.
@Senff, thank you for your article, and I think it's a good tutorial on getting up and running quickly! I don't think Sass is that hard to get running on Windows with Ruby, though. You can use the Rails Installer. It will install everything you need, and to get Sass running you just have to run a few commands, and that's all.
an alternative to Compass is Bourbon
it even has a layout system, similar to Susy called Neat
Just a follow up on my previous post: still using SCSS. It's completely changed how I write CSS. I use generally use Compass through the Terminal (don't use Codekit, stopped using LiveReload). We've even built it into our basic framework.
here is good mixin for rem/px fallback
https://github.com/bitmanic/rem
if you're using Susy, you need to change the mixin name to rems, since susy has a mixin named rem already though it isn't used the same way.