-1

I just started with materialize but now I'm faced with a problem.

When I want to use: @media #{$small-and-up} { media query in my own scss file I get the following error: Error: Undefined variable: "$medium-and-up". While I'm importing the materialize.css file which is compiled from /sass/materialized.scss.

So my question is how can I use the variables / media querys in my own scss file? I compile the scss by the file watcher plug-in in PHPStorm or by sass compiler installed in command prompt windows.

I hope someone can help me.

SuperDJ
  • 7,488
  • 11
  • 40
  • 74

1 Answers1

3

SASS variables don't exist in compiled CSS files. If you want to use variables defined in materialized.scss in your own SCSS stylesheet, you need to insert @import "sass/materialized.scss" in your stylesheet.

Incidentally, if you do this, you probably won't need to compile materialized.scss any more. Just compile your SCSS stylesheet, which, because of the @import statement, will pull in materialized.scss.

UPDATE:

After reviewing code at https://github.com/SuperDJ/dsuper/blob/master/private/admin/css/sass/opening.scss, it seems the problem is with this line:

@import url(/private/admin/css/material/sass/materialize.scss); 

This is not valid syntax in SCSS. It should be:

@import "../material/sass/materialize";
Ben Cook
  • 1,654
  • 2
  • 18
  • 32