Unable to use Less.Parse using dotless in c#

2019-08-08 19:26发布

问题:

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?

回答1:

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

dotless.Core.Less.Parse(css)



回答2:

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.