heneryville
heneryville

Reputation: 2929

Less isn't showing me its errors

When using client-side compilation for less, and if there are errors, Less is not showing me what those errors are. It's supposed to insert some HTML, but it seems not to be doing this. The HTML on the page after Less runs looks like:

<html>
  <head>
  <link rel="stylesheet/less" type="text/css" href="/Content/less/all.less">
  <script src="/Content/js/libs/less-1.3.0.min.js" type="text/javascript"></script>
  <style type="text/css" media="screen" id="less:error-message">
   --SNIP--
  }</style>
  </head>
  <body>         
  </body>
</html>

As you can see, the less error css is generated, but not the html.

Upvotes: 19

Views: 7358

Answers (2)

Umesh Gaire
Umesh Gaire

Reputation: 19

I am very new with SCSS and came to this post to know the error of SCSS with LESS. I just want to say many thanks, who asked it @heneryville

<style type="text/css" media="screen" id="less:error-message">

and also thanks for the answer of it :

<script type="text/javascript">less = { env: 'development' };</script>

And many thanks @user1267519

I can see the SCSS errors now easily:

enter image description here

Now I can solve errors easily.

Upvotes: 0

user1267519
user1267519

Reputation: 426

Add this script before including less.js in your head:

<script type="text/javascript">less = { env: 'development' };</script>

This tells less.js that it is OK to display error messages in the browser as we are still dev'ing the page.

Upvotes: 41

Related Questions