- Overview
- Transcript
2.1 Install Method 1: The Command Line
In this lesson you’ll learn how to use the command line to install and compile Sass.
Related Links
1.Introduction3 lessons, 05:39
1.1Welcome00:27
1.2What Are Preprocessors?02:43
1.3The Course Structure02:29
2.Installing and Using Sass2 lessons, 05:48
2.1Install Method 1: The Command Line03:07
2.2Install Method 2: Dedicated Apps and Services02:41
3.Week 17 lessons, 59:11
3.1Day 1: Syntax08:09
3.2Day 2: Nesting11:50
3.3Day 3: Nested Properties05:04
3.4Day 4: Variables06:22
3.5Day 5: Interpolation05:36
3.6Day 6: Data Types13:32
3.7Day 7: Operations08:38
4.Week 27 lessons, 44:27
4.1Day 1: @import Directive06:04
4.2Day 2: Partials03:02
4.3Day 3: @media Directive04:35
4.4Day 4: @extend Directive05:43
4.5Day 5: @if and @for Directives08:36
4.6Day 6: @each and @while Directives11:03
4.7Day 7: Mixins05:24
5.Conclusion1 lesson, 00:54
5.1Final Words00:54
2.1 Install Method 1: The Command Line
Sass is written with Ruby. This is a programming language. So to use Sass, you need to have Ruby installed. Now, if you're using a Mac, then you already have Ruby pre-installed. You don't have to do anything. However, if you are using Windows, the easiest way to install Ruby is with Ruby installer. If you are using Linux, you can find details in the official Ruby documentation. I am using a Mac, so I already have it installed. Now, the next thing you need to do is open the terminal or the command line. In Mac OS and Linux, it's called the terminal. In Windows, it's called the command prompt. Before we decide whether or not we should install Sass, we need to check if we don't have it installed already. For this, you need to type in the command line sass space -v, if you will get aversion number then you already have Sass installed. However if you get an error message then you need to install it. To do that, type gem install sass. If you get an error saying that you don't have enough permissions, you need to type sudo gem install sass. This basically means, install as admin. It will ask for your admin password and should successfully install the package. Now to make sure you installed it correctly, go ahead and type sas-v again in the terminal. Now it should give you the version number. That's how you install Sass via the command line. Now how do you actually compile Sass to CSS? Well, here's a demo Sass file. It has the extension of .css and it's inside a folder called project on my desktop. First thing you'll need to do is navigate to your working folder. To do that, use the cd commands, or change directory. So, in our case it's cd, space and then the path to your folder. And once you are in the project folder, you simply type sass watch master.scss:master.css. So you're basically telling Sass to watch for the master.css file, and to compile it to master.css. This will, of course, compile the Sass file, and also start a watch action that will keep an eye on the master.css file and then as soon as that see the change it will recompile it. And that's how you compiles Sass by using the command line. Now, If you don't fancy the command line, there are some third party absent services that can compile Sass for you, automatically. You learn about those in the next lesson.