Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS ERROR : Properties are only allowed within rules, directives, mixin includes, or other properties

Error: @import "./styles/mixins"; ^ Properties are only allowed within rules, directives, mixin includes, or other properties.

My scss file is as simple as that :

@import "./styles/mixins";

// There shouldn't be anything else
// Set my variables


@import "styles/variables";

@import "styles/core-style";

@include font-importer("Raleway Regular",'normal',400,"./assets/fonts/Raleway/Raleway-Regular.ttf");
@include font-importer("Raleway Bold",'normal',700,"./assets/fonts/Raleway/Raleway-Bold.ttf");
@include font-importer("Raleway Light",'normal',300,"./assets/fonts/Raleway/Raleway-Light.ttf");
@include font-importer("Raleway Medium",'normal',500,"./assets/fonts/Raleway/Raleway-Medium.ttf");

What does it mean ? I don't understand Sass error. I don't understand where to look at. What do I have to do ?

Thanks,

Stéphane.

like image 829
Stefdelec Avatar asked Feb 01 '18 08:02

Stefdelec


People also ask

What is the use of @include in Sass?

The @include directive is created to let you use (include) the mixin. A mixin is defined with the @mixin directive. ... Tip: A tip on hyphens and underscore in Sass: Hyphens and underscores are considered to be the same. This means that @mixin important-text { } and @mixin important_text { } are considered as the same mixin!

What is the difference between @mixin and @include in Sass?

The @mixin directive lets you create CSS code that is to be reused throughout the website. The @include directive is created to let you use (include) the mixin. A mixin is defined with the @mixin directive. ... Tip: A tip on hyphens and underscore in Sass: Hyphens and underscores are considered to be the same.

Why can’t I see a property declaration in Sass?

Sometimes you only want a property declaration to show up some of the time. If a declaration’s value is null or an empty unquoted string, Sass won’t compile that declaration to CSS at all.

What are custom properties in Sass?

Custom Properties In Sass as in CSS, property declarations define how elements that match a selector are styled. But Sass adds extra features to make them easier to write and to automate. First and foremost, a declaration's value can be any SassScript expression, which will be evaluated and included in the result.


1 Answers

What does your font-importer return?

Error explanation:

Properties are only allowed within rules, directives, mixin includes, or other properties.

That means that you call you mixin outside css selector.
For example this code will produce the same error:

@mixin color() {
  color: red;
}

@include color(); // call mixin without css selector
like image 178
3rdthemagical Avatar answered Sep 28 '22 11:09

3rdthemagical