本文介绍了如何在Visual Studio中使用多个SCSS文件的引用路径来利用Intellisense,而不必将其添加到每个文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中,您可以在.scss文件中使用以下语法在SASS/SCSS文件中包括引用路径:

In Visual Studio you can include reference paths within your SASS/SCSS files using the following syntax within a .scss file:

/// <reference path="vars.scss" />

这对于为SASS变量和mixins提供智能感知非常有帮助.现在,我必须手动将参考路径添加到每个SASS文件中,以获取此好处.

This is very helpful for providing intellisense for SASS variables and mixins. Right now I have to add a reference path manually to every single SASS file to get this benefit.

有没有一种方法可以为您的sass文件定义全局"引用路径,您可以在其中定义一次路径,以便以后所有sass文件中都可以使用该路径?

Is there a way to define "global" Reference Paths for your sass files, where you could define a path once, so that it is available in ALL sass files going forward?

我遇到了一个问题,我想从各种程序包中引用多个SASS文件,但又不想为每个单个SASS文件添加多个引用路径.

I'm running into an issue where I want to reference multiple SASS files from various packages, but do not want to have to add multiple reference paths to every single SASS file.

另一方面,有人知道Visual Studio的<reference path="">上有文档吗?

On another note: does someone know where there is documentation on <reference path=""> for visual studio?

推荐答案

我认为您可以定义一个名为_references.scss的全局文件,然后将所有引用的scss文件放入其中.该文件必须位于项目根目录下的名为Css的文件夹中.

I think you can just define a global file named _references.scss and then put all referenced scss files into it. This file must be located in the folder named Css which you at the root of your project.

然后将类似的内容添加到_references.scss

Then add like these into _references.scss

/// <reference path="vars.scss" />
/// <reference path="content.scss />
/// <reference path="background.scss" />

要使用它时,只需引用唯一的全局文件_reference.scss.

When you want to use it, just reference the unique global file _reference.scss.

希望它可以为您提供帮助.

Hope it could help you.

这篇关于如何在Visual Studio中使用多个SCSS文件的引用路径来利用Intellisense,而不必将其添加到每个文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:26