Less - 动态样式表语言?
在谷歌搜索以更少的写作做更多的CSS时,我发现了这个 - http://lesscss.org/
有人尝试过吗它可以在 IE6+、Firefox 3+、Chrome、Safari、Opera 以及我们都使用的所有标准网络浏览器下运行吗?
提前致谢 :)
While googling around for doing more css with less writing and I found this - http://lesscss.org/
Has anybody tried it and is it working under IE6+, Firefox 3+, Chrome, Safari, Opera and all of the standard web browsers we all use?
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
http://leafo.net/lessphp/
这是预处理器的 PHP 版本。您创建 .less 文件并将其上传到站点。预处理器会完成剩下的工作。适用于任何浏览器,因为浏览器只接收处理后的 CSS 文件,而不是 LESS 文件。您需要做的就是在您的index.php中添加类似的内容:
然后只需使用
style.less.css
作为您网站的样式表。http://leafo.net/lessphp/
This is the PHP version of the preprocessor. You create the .less file and upload it to the site. The preprocessor does the rest. Works in any browser because the browser only receives the processed CSS file, not the LESS one. All you need to do is add something like this in your index.php:
and then simply use
style.less.css
as your site's stylesheet.你可以在服务器端生成css,或者使用LESS.js,在第一种情况下,客户端甚至不知道样式的LESS起源,所以它就像css一样(不依赖客户端js)。
You can generate the css server side, or use LESS.js, in the first case, the client is not even aware of the LESS origin of the style, so it's just like css (doesn't rely on client js).
只要启用 javascript 就可以,因为样式表链接后面添加了一个 js 脚本,有助于在 ie6+ 和所有其他主流浏览器中显示它。
如果您还计划容纳未启用 JavaScript 的用户,您可以在服务器端进行处理,但我还没有这样做,因此无法保证此方法。
山姆
As long as javascript is enabled yes, as there is a js script added after the stylesheet link that helps display it in ie6+ and all other mainstream browsers.
If you are also planning on accomodating users who don't have javascript enabled you can do the processing server side, I haven't done this however, so can't vouch for this method.
Sam
我尝试过 LessCSS 和一系列其他类似的替代方案,但最终选择了 SASS (SCSS) - 它可以使用小型 Ruby Gem 进行预编译,这使得它在开发中使用起来超级简单、快速。如果您使用 Rails,那么与 Ruby 的集成是一个很好的优点。
http://sass-lang.com/
- 将它与 Compass CSS 框架 (http://compass-style.org/) 一起使用,你就得到了一个非常糟糕的设置!
I have tried LessCSS and a range of other likewise alternatives, but settled on SASS (SCSS) - it can be precompiled using a small Ruby Gem which makes it super easy and fast to use in development. The integration to Ruby is a nice plus when working with e.g. Rails if u do that stuff.
http://sass-lang.com/
- use it with the Compass CSS framework (http://compass-style.org/) and you got a pretty badass setup!