Unable to use Less.Parse using dotless in c#

2019-08-08 19:38发布

I am following the link https://github.com/dotless/dotless/wiki/Using-.less to minify the css. I have include the dll and made Web.config changes.

However when the refer it in index.cshtml as Less.Parse , the Less namespace is not available and and getting the exception "The name Less does not exists in the current context"..

can somebody advise what am I missing?

2条回答
老娘就宠你
2楼-- · 2019-08-08 20:06

I have solved it.. just missing parent name space and conversion works like a charm

dotless.Core.Less.Parse(css)

查看更多
神经病院院长
3楼-- · 2019-08-08 20:18

If you are using Visual Studio, Web Essentials has support for less.

http://vswebessentials.com/features/less

I often use it for :

  • .less to .css preview
  • View output from a .less compile
  • Extract variables/mixins

After build if you go to Output and select Web Essentials from the 'Show output from:' dropdown, you will see a date, time and the list of .less files that have compiled.

查看更多
登录 后发表回答