带插值的SCSS媒体查询



我无法使用媒体查询标题作为插值。当像下面这样使用它时,它会给出一个错误

$token-screen-md: "@media only screen and (min-width: 48rem)";
#{$token-screen-md} {
display: table-row;
min-width: 100%;
}

有人能帮我解决这个问题吗?

"模块构建失败(从./node_modules/sass-loader/dist/cjs.js(:SassError:需要选择器。@仅介质屏幕和(最小宽度:48rem({〃

$mobile: "only screen and (max-width : 767px)"; 
$tablet: "only screen and (min-width : 768px)";
$desktop: "only screen and (min-width : 1025px)";
@media #{$mobile} {
/* my styles for mobile displays */
}`

摘自"如何使用SASS插值定位两个媒体查询?"?

最新更新