Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Berry Wilson
Berry Wilson
5,983 Points

Getting sass command prompt to work with text file saved as 'test.scss'

I am using windows 7 and cant get it to work. In the text file I have to type:

{ color,blue: }

this somehow is meant to appear in the command prompt but it doesn't - but how do I get the text file and the command prompt to speak to each other??

Sean T. Unwin
Sean T. Unwin
28,690 Points

I'm not exactly sure what you're asking, but the correct CSS sytax for your example is { color: blue; }.

If your question is related to a particular course, please state which course and possibly paste the link to the lesson you're having trouble with.

I have edited your post to be highlighted in the correct category -- from General Discussion to CSS.

7 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

To output the contents of a .sass, .scss or .css file to the terminal/ cli:

# simply type 'sass' followed by the file name
sass myfile.scss

Note: Be wary when doing this with sass partials as any variables which are not declared in the viewed file will result in an error.


To use the interactive shell (play with Sass without saving to a file):

# Type the following
sass --interacive
# OR the shorthand way
sass -i

# Example
sass -i
# Interactive shell enabled. You will see 2 greater-than arrows
# start typing your Sass
>> lighten(#343dde, 20)
# output results (the result in this case is a hex color code, not a comment):
#8c91ec
>>

You should return an error as that is not valid CSS code. Sass has great features, but you use valid CSS even in Sass. You also have to have given the command for sass to watch the file. But I don't think that will display the value in the command prompt, only that it has created or updated a file.

Berry Wilson
Berry Wilson
5,983 Points

Hi Ted,

Many thanks - that is right sass will watch the file and it also creates another file as well - what I want to happen and what is not explained at all is how to make sass display the value that is in the text file in the command prompt. - Any ideas??

Berry Wilson
Berry Wilson
5,983 Points

Hi Sean,

Many thanks - this is what I am having trouble with: https://teamtreehouse.com/library/sass-basics/getting-started-with-sass/installing-and-using-sass-2 - if you look at this there are 2 windows open the one on the right is the text editor and on the left is the command prompt - how do you get what you type in the text editor to go to the command prompt. The course does not explain that all. In the teachers notes there are a few links but none I can find explaining how to do this. Your help would be very much appreciated.

Kind regards,

Berry.

Berry Wilson
Berry Wilson
5,983 Points

Wow Sean,

That was supper quick - thanks - I will try to get this to work over the w/e and will sure let you know the result; many many thanks.

Kind regards,

Berry.

Berry Wilson
Berry Wilson
5,983 Points

Hi Sean,

Have given it a try the interactive shell works just fine but I can't get it to recognize my file . Have successfully installed Sass 3.4.13 I have tried typing in your suggestion. The test.scss file is saved to desk top. I type in sass test.scss and the following is returned (why cant I just paste my screen shot in?)

Errno::ENOENT: No such file or directory @rb_sysopen - test.scss Use --trace for backtrace.

Help I do not have a clue what is going on!!

Kind regards,

Berry

Sean T. Unwin
Sean T. Unwin
28,690 Points

You have to either cd in your terminal to the directory where the file is or type in the correct path to the file.

cd path/to/desktop
sass < filename >

# OR

sass /path/to/desktop/filename

You need to change the command prompt directory to the one you are going to monitor, so make sure you have done that. The path is probably c:\users\user_name\desktop.

Once you are in the right directory, use this command, including the period:

sass --watch .

That should take your .scss or .sass file and create the css file.

I am assuming you have installed Ruby and Sass through the command prompt or are using a program like Scout.

When you open the command prompt in Windows 7 it starts in your user folder. You should be able to type:

cd desktop

That will put you on the desktop. You can test that by typing dir. That will give you a list of files and folders in the location you are at. You should see your test file there. Then follow the earlier directions to watch the file or location.

Berry Wilson
Berry Wilson
5,983 Points

Hi you were all helpful - thanks, but I am still struggling to get it all to work so I have tried scout which seems ok ish - 4 the moment.!!