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 The Rails Asset Pipeline and Styling Styling a Header Write SCSS Variables and Helpers

Variables do not get imported from variables.css.scss. WHY?

Hi guys, I'm importing the variables.css.scss file in my application.css.scss:

/*<<<<<<< HEAD:app/assets/stylesheets/application.css
=======

 *= require_tree .
>>>>>>> design:app/assets/stylesheets/application.css.scss
 *= require_self

 */
@import "foundation_and_overrides";
@import 'modules/variables.scss';
@import 'modules/helpers';
@import 'partials/header';
@import 'partials/parks';
@import 'partials/trees';

Here are the variables:

$brown: rgb (123,63,0);
$green: rgb(86,130,3);

The file is found and imported, but then it tells me: "Undefined variable: "$green"."

If I define the variable at the top of the header.css.scss, it works just fine. However, it does not work when I try to import the variables from variables.css.scss. And I know the import is successful since the when I misspell the name of the file it will complain it cannot find it. Can anyone help?

1 Answer

My bad! I forgot to remove the *= require_tree . statement :-) It's working fine now.