如何在浏览器中编译LESS文件 [英] How can I compile LESS files within browser

查看:232
本文介绍了如何在浏览器中编译LESS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了用于使用LESS功能切换主题的代码.不幸的是,LESS文件不会在浏览器中编译.如何在浏览器中编译LESS文件?

I created code for switching themes using LESS functionality. Unfortunately the LESS files will not compile in browser. How can I compile LESS files within browser?

推荐答案

这是文档:

客户端使用情况

将.less样式表与rel设置为"stylesheet/less"相关联:

Link your .less stylesheets with the rel set to "stylesheet/less":

<link rel="stylesheet/less" type="text/css" href="styles.less">

然后从页面顶部下载less.js,并将其包含在 页面的<head>元素,如下所示:

Then download less.js from the top of the page, and include it in the <head> element of your page, like so:

<script src="less.js" type="text/javascript"></script>

确保在脚本之前 包含样式表.

Make sure you include your stylesheets before the script.

因此,您需要:

  1. link标签放置在之前 script标签
  2. rel设置为stylesheet/less
  3. 请注意 Chrome中的错误
  1. place link tag before script tag
  2. set rel to "stylesheet/less"
  3. be aware of bug in chrome

这篇关于如何在浏览器中编译LESS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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