I have vue application using typescript and when I compile my code then I getting the following error:
Failed to compile.
./src/style.scss (C:/../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!C:/.../node_modules/vue-loader/lib/loaders/stylePostLoader.js!C:/.../node_modules/postcss-loader/src??ref--8-oneOf-1-2!./src/style.scss)
Module build failed (from C:/.../node_modules/postcss-loader/src/index.js):
SyntaxError
(10:14) Unknown word
8 |
9 | @if $point == big {
> 10 | @media #{$bp-big} {
| ^
11 | @content;
12 | }
I'm not sure why scss not recognize variables? what does mean of Unknown word ? and how to solve this issue?
This is how my app.vue
looks:
<template>
...
</template>
<style lang="scss">
@import url('./style.scss');
</style>
Here is the mixin inside style.scss
:
@mixin bp($point) {
$bp-xsmall: '(min-width: 320px)';
$bp-teeny: '(min-width: 480px)';
$bp-tiny: '(min-width: 600px)';
$bp-small: '(min-width: 650px)';
$bp-medium: '(min-width: 800px)';
$bp-big: '(min-width: 1000px)';
@if $point == big {
@media #{$bp-big} {
@content;
}
} @else if $point == medium {
@media #{$bp-medium} {
@content;
}
} @else if $point == small {
@media #{$bp-small} {
@content;
}
} @else if $point == tiny {
@media #{$bp-tiny} {
@content;
}
} @else if $point == teeny {
@media #{$bp-teeny} {
@content;
}
} @else if $point == xsmall {
@media #{$bp-xsmall} {
@content;
}
}
}