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 Getting Modular with Mixins and Functions Pixels to Em Function

Ian Mackenzie
Ian Mackenzie
11,062 Points

error scss/_base.scss (Line 22: Undefined variable: "$font-weight--light".)

These are my variables:

// ==========================================================================
// Global Config
// ==========================================================================

// Font Stacks

$font-url--google: 'http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900';
$font-family--primary: ‘Lato’, ‘Helvetica Neue’, Helvetica, Arial, sans-serif;
$font-family—secondary: ’Helvetica Neue’, Helvetica, Arial, sans-serif;

// Font Weights

$font-weight—-thin: 100;
$font-weight—-light: 300;
$font-weight—-medium: 400;
$font-weight—-bold: 700;
$font-weight—-ultra-bold: 900;

// Descriptive Base Colors

$white: #fff;
$black: #0b0b0b;
$grey: #797e83;

$fountain-blue  : #52bab3;
$emerald        : #5ece7f;
$sunglo         : #e67478;
$coral          : #ff784f;
$purple-majesty : #9279c3;
$scooter        : #39add1;

// Color Usage

$color-primary: $fountain-blue;
$color-secondary: $scooter;
$color-accent: $emerald;
$color-shadow: rgba($black, .2);

// Text

$base__font-size: 16px;
$base__line: 24px;
Ian Mackenzie
Ian Mackenzie
11,062 Points

These are my _base styles:

// ==========================================================================
// Base Styles
// ==========================================================================

* {
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-size: $base__font-size;
    line-height: ($base__line/$base__font-size);
    font-family: $font-family--primary;
}

header {
  text-align:center;
  padding: em(48px) 0;
}

h1 {
    font-weight: $font-weight--light;
    font-size: em(42px);
    line-height: (46px / 42px);
    margin-bottom: em(70px, 42px);
}

h2 {
    font-family: $font-family--secondary;
    font-weight: $font-weight--thin;
    font-size: em(24);
}

Also my application.scss shows the base import in red?

@import 'config';
@import 'helpers';
@import 'utilities';
@import 'reset';
@import 'base';
@import 'main';

This is my _untilities.scss where the variable is defined.

// Import if Google Fonts URL is defined

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

// Functions and Directives

@function em($target, $context: $base__font-size) {
    @return ($target / $context) * 1em;
}

1 Answer

How about your command line directory? Are you in the correct directory? For example, are you watching files from the wrong directory like "video-2" instead of "video-3"?