nCardot
nCardot

Reputation: 6595

What is a directive (such as @import and @mixin)?

I saw the "@mixin directive" and "@import directive" being referred to in articles about Sass, but I'm not clear on what a directive is.

In th context of computer programming, Wikipedia defines it as follows:

a directive or pragma (from "pragmatic") is a language construct that specifies how a compiler (or other translator) should process its input

Is this what a "directive" also means in the case of the examples I referenced?

Upvotes: 0

Views: 93

Answers (1)

Anuj Rastogi
Anuj Rastogi

Reputation: 98

A directive is an instruction to the compiler to process the code.

for Example:-

@mixin transform($property) {
  -webkit-transform: $property;
  -ms-transform: $property;
  transform: $property;
}

.box { @include transform(rotate(30deg)); }

Mixin property is defined only once, and when you are declaring mixin reference then you are instructing to the compiler to get the reference first of mixin and then compile. same this is happening import as well.

Upvotes: 1

Related Questions