少不告诉我它的错误 [英] Less isn't showing me its errors

查看:69
本文介绍了少不告诉我它的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用客户端编译较少的内容时,如果存在错误,Less不会向我显示这些错误是什么.应该插入一些HTML,但是似乎没有这样做. Less运行后,页面上的HTML看起来像:

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>

如您所见,生成的错误css更少,但是html却没有.

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

推荐答案

在将less.js包含在脑海中之前,请添加以下脚本:

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

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

这告诉less.js,可以在浏览器中显示错误消息,因为我们仍在设计页面.

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

这篇关于少不告诉我它的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆