较少的CSS性能和实现 [英] Less CSS performance and implementation

查看:124
本文介绍了较少的CSS性能和实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用LESS CSS的最佳方法是什么。

What are the best ways to use LESS for CSS.


  • 基本上应该是Devs编写一个Less文件,生产

  • 我应该链接LESS代码和javascript文件。

  • 或者我应该完全跳过LESS代码并重新创建类

我试图将一些相当粗糙的CSS绑定在一起,并希望在进行重大改进之前获得控制权。我认为这将是非常好的网站泛变量所以少看起来像一个好东西与变量和嵌套。

I am trying to wrangle together some rather sloppy css and want to get control of it before making major improvements. I think it would be very good to have site wide variable so Less seems like a good thing with the variables and nesting.

我用css渐变和框阴影替换了很多背景图片,所以我也试图摆脱供应商前缀。有时我看到什么样的看起来像类重载,但不好的附加很多类到一个元素如

I am replacing a lot of the background images with css gradients and box shadows so I am also trying to get rid of the vendor prefixes. Sometimes I see what kindof looks like class overload but is it bad to append a lot of classes to an element such as

<div class="comment dark-shadow round-corners"></div>


推荐答案

Less是一种优秀的造型语言。我使用它广泛,它真正有助于代码的可维护性,以及写的风格的速度。

Less is a great styling language. I use it extensively, and it really helps with code maintainability, as well as with speed of writing the styles.

我个人觉得你的风格不应该依赖于javascript渲染,所以我使用less.app来将我所有的LESS编译成CSS。我安静地休息,知道我所有的CSS都在那里,它在我投入任何活之前正确工作。

I personally feel that your styles should not be dependent on javascript to render, so I use the less.app to compile all my LESS into CSS. I rest more peacefully knowing that all my CSS is there and that it works correctly before I put anything "live".

如果你有兴趣,我也编译了一个LESS可以非常有用的mixin库: https://github.com/jdmiller82/-lessins-

If you are interested I have also been compiling a LESS mixin library that can be very useful: https://github.com/jdmiller82/-lessins-

这篇关于较少的CSS性能和实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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