可以在Sass文件的import语句中使用变量吗? [英] Can variables be used in import statements for Sass files?

查看:416
本文介绍了可以在Sass文件的import语句中使用变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In Less我可以做这样的事情

In Less I can do something like this

@basePath:"../../some_crazy_project_path_to_repeat/less/";
@import "@{basePath}less.less";

所以我试着在Sass做同样的事情

So I tried to do the same thing in Sass

$basePath:"../../some_crazy_project_path_to_repeat/less/";
@import "${basePath}less.scss";
// Syntax error: File to import not found or unreadable: ${basePath}less.scss.

@import "#{basePath}less.scss";
// Syntax error: File to import not found or unreadable: #{basePath}less.scss.

有没有办法在Sass中执行此操作?

Is there a way to do this in Sass?

推荐答案

您不能在SASS中使用条件材料进行导入。

You can't use conditional stuff for imports in SASS.

考虑创建指南针扩展项目。

这篇关于可以在Sass文件的import语句中使用变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆