How can you use Reference Paths for multiple SCSS Files in Visual Studio, to utilize Intellisense, without having to add it to every file?

痴心易碎 提交于 2020-02-05 05:15:08

问题


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" />

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.

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?

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.

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


回答1:


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

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.

Then add like these into _references.scss

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

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

Hope it could help you.



来源:https://stackoverflow.com/questions/59329833/how-can-you-use-reference-paths-for-multiple-scss-files-in-visual-studio-to-uti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!