less.js和styles.less的目的是什么 [英] What is the purpose of the less.js and styles.less
问题描述
有人可以解释为什么我要使用less.js脚本及其样式表吗?我不明白目的及其优势.谢谢你.埃里克
Can someone explain why I would want to use the less.js script along with its stylesheet? I don;t understand the purpose and its advantages. Thank you. Erik
推荐答案
Less.js 是CSS预处理程序,这意味着您将能够使用Less pre编写样式. -c语言在*.less
文件中,然后Less.js会将其编译为纯CSS.
Less.js is a CSS pre-processor, it means that you will be able to write your in style using the Less pre-processor languages in a *.less
file, then Less.js will compile it into pure CSS.
CSS预处理器具有许多强大的功能,例如:变量, mixins ,嵌套规则, operations ,导入和一个更多.
CSS pre-processor comes with a lot of powerful features such as: variables, mixins, nested rules, operations, imports and a lot more.
使用Less.js,您有两个选择:
With Less.js you have two options:
- 在客户端上运行Less:在Less中编写样式,然后包括JavaScript预处理器:
Less.js
. - 在服务器端运行Less:在Less中编写样式,然后使用Node.js或Rhino运行预处理器,在其他情况下,您可以使用某些端口,例如
- Running Less at client-side: write your styles in Less then include the JavaScript pre-processor:
Less.js
. - Running Less at server-side: write your styles in Less then run the pre-processor using Node.js or Rhino, and in other cases you may use some ports like DotLess.
如果您有潜在的大型Web界面设计(复杂的布局,子画面,多种导航,多种形式等),那么您应该考虑使用一种流行的CSS预处理器,例如 Less.js 或 Sass . 他们会为您提供很多帮助.
If you have potentially large Web Interface Design (complex layout, sprites, multiple navigation, several forms, etc...) then you should consider using one of the popular CSS pre-processor like Less.js or Sass. They will help you a lot.
请紧记... ,在CSS预处理器之上有一个大型项目,指南针是一个不错的框架,它可以消除与以下内容有关的痛苦跨浏览器问题,涉及 inline-blocks , clearfix , box-shadow 等...
Keep in mind... there are big project build on top of CSS pre-processor, Twitter Bootsrap use Less and Compass is a great framework that will kill your aches related to cross-browser issues concerning inline-blocks, clearfix, box-shadow, etc...
这篇关于less.js和styles.less的目的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!