较少的css文件包含在< head>部分 [英] Less css file include in <head> section

查看:97
本文介绍了较少的css文件包含在< head>部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些文件需要包含在< head> 节中,以减少css。在较少的官方网站,我刚刚看到他们告诉包括.less和.js文件。但它不工作没有.css文件。

解决方案

参考LESS文档:



链接您的.less样式表将rel设置为stylesheet / less:

 < link rel =stylesheet / lesstype = csshref =styles.less/> 

然后从页面顶部下载less.js,并将其包含在页面的元素中,像这样:

 < script src =less.jstype =text / javascript>脚本> 

请务必在脚本前加入样式表。

此方法将使较少文件充当常规css文件,因此不需要其他文件。



这是不是一个良好的做法生产环境。你应该编译你的less文件到css文件,并将其包含在您的部分,没有任何less-或js文件。


Which files are needed to include in <head> section for less css. At less official site , i have just seen that they have told to include .less and .js file. But it is not working without .css file.

解决方案

Referring to LESS documentation:

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

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

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

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

Make sure you include your stylesheets before the script.

This method will cause the less-file act as a regular css-file so no additional files are needed.

This is not a good practice for production environments though. You should compile your less-file to css-file and include it in your -section as is without any less- or js-files.

这篇关于较少的css文件包含在&lt; head&gt;部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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