如何在浏览器中编译LESS文件 [英] How can I compile LESS files within browser
问题描述
我创建了用于使用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.
因此,您需要:
- 将
link
标签放置在之前script
标签 - 将
rel
设置为stylesheet/less
- 请注意 Chrome中的错误
- place
link
tag beforescript
tag - set
rel
to"stylesheet/less"
- be aware of bug in chrome
这篇关于如何在浏览器中编译LESS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!