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

Modular CSS with Sass code, Challenge task 1 of 1

Use a Sass introspection function to import the URL value of the $font-url variable, if it exists in the current scope.

this is my code:

@if varible-exists(font-url) { @import url(font-url); }

And eror: Bummer! You need to call the variable-exists function.

Can someone suggest what is wrong in my code ?

9 Answers

@if variable-exists(font-url) { @import url($font-url); } CORRECT

You misspelled variable in your if statement :)

Thanks:)

I know what already is happening.

The parameter of variable-exists, should not have "$", but inside the function when you import the URL yes you need put the "$".

Let me know if working.

@if variable-exists(font-url--google) { @import url($font-url--google); } CORRECT thank you!

Just you forget the $ on the variable inside the "url"; @if varible-exists(font-url) { @import url($font-url); }

Thanks:)

I used this and still get it wrong

@if variable-exists($font-url) { @import url($font-url); }

I got this error Sass Error: Undefined variable: "$font-url".

you set the variable in another file?

$font-url: 'http://fonts.googleapis.com/css?family=Roboto';

They only give us 1 file. style.scss

putting this I got the same error. $font-url: 'http://fonts.googleapis.com/css?family=Roboto'; @if variable-exists($font-url) { @import url($font-url); }

Try with this:

$font-url--google : 'http://fonts.googleapis.com/css?family=Roboto:400,100,300,100italic,300italic,400italic,500,500italic,700,700italic,900,900italic';

@if variable-exists(font-url--google) { @import url($font-url--google); }

That is the same code from the workspace. I tried and even remove the --google but still did not work.

Yes, but maybe with declare options in the font helps.

Can you say me what the error said?

You need to call the variable-exists function, passing the name of the font-url variable as a parameter.

Great! :)