SASS with Visual Studio Part 3 Real World

Since I already covered the intro, install, features and syntax of SASS. It’s time to show some real-world application of SASS. If used properly, SASS can really save you time.

Sprites

One area that I find SASS particularly helpful is sprite creation. The idea optimising your site by pasting few images together and decreasing the number of requests is not new and is pretty cool. Usually, you would create the image and then manually write the CSS or upload the files on-by-one to online services that would create the spites for you. With SASS, you have can create a helper method … and that’s it!

This mixin will let you easily create any sprites and result in CSS below. Note the usage of image-url and image-height methods. They are in-build compass features, that will automatically get properties form the set image.

If you want to go even further, compass will create sprites for you automatically. Check out sprite utils.

Mixing CSS

Another cool way to use SASS is the ability to combine multiple scss files together. In this way, you can mix and match between your stylesheets, move your mixins and variables into separate reusable files and then decide what you need. SASS will pull it all together into single file.

Imports all the scss files into a single file – great for re-using parts.

Grid Systems

We push 3-4 apps live every month, most of them based on the grid system. However, some of them would have 2-3 different layouts – a site based on 960px, Facebook tab on 520px and canvas on 760px. Each of them also have different gutters, different column numbers, sometimes some other funk in them. In short, we deal with loads of grid variations. There are sites that create these for you, but it’s faster if you have something that does it all for you that you can alter in place.