简体   繁体   中英

How to get Intellisense in LESS files in Visual Studio 2015

I recently moved my CSS structure to LESS and it's great, I really see many benefits from using LESS compared to plain CSS.

The only issue I had so far is with Visual Studio 2015, because my LESS code is distributed into different files and folders I always get a Intellisense error like " Undeclared mixin " or " Undeclared variable ".

智能感知错误

This simply happens because my mixins, variables and other pieces of code are in different files and there's no automatic way for VS to know where they are.

Does anyone know how to solve this?

尝试在使用变量的文件中添加“ @import(引用)...”。

@import (reference) "FileWithVariables.less";

First and foremost, have you installed the Web Essentials LESS extension?

On second thoughts , just fit a reference comment on top of your document like so:

/// <reference path="variables.less" />

Where the path="" will be the exact path to your file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM