HAML、SASS/Compass 和 ERB 之间的主要区别是什么?

发布于 2024-07-18 09:06:12 字数 63 浏览 4 评论 0原文

我正在寻找模板引擎。 在 HAML、SASS/Compass 和 ERB 之间进行选择时需要考虑哪些重要因素?

I'm looking for a templating engine. What are the important factors to consider when choosing among HAML, SASS/Compass and ERB?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末骤雨初歇 2024-07-25 09:06:12

总结一下:

  • Haml 是一种标记语言
  • Sass 是一组可编译为标准 CSS 的 CSS 扩展
  • Compass 是 Sass 的包装器,围绕 Blueprint 之类的内容
  • Erb 只是带有嵌入式 Ruby 代码的 HTML。

一般来说,您会查看 Haml 或 Erb(尽管您可以根据需要混合搭配它们)以及 CSS 或 Sass。 Compass 只是 Sass 的一个附加组件。

我建议从 Haml 和 Sass 开始,因为 Haml 消除了 HTML 中大部分烦人的、容易出错的方面。 一旦你习惯了用 Haml 写作,使用 Erb 就会感觉很啰嗦。

至于CSS,选择一个框架(例如Blueprint),然后按原样使用它来启动。 如果您觉得需要,您可以随时添加指南针。

To summarize:

  • Haml is a markup language
  • Sass is a set of CSS extensions that compile into standard CSS
  • Compass is a wrapper for Sass around things like Blueprint
  • Erb is simply HTML with embedded Ruby code.

Generally, you'll be looking at Haml or Erb (though you can mix and match them if you need to), and CSS or Sass. Compass is simply an add-on to Sass.

I'd recommend starting with Haml and Sass, as Haml takes most of the annoying, bug-prone aspects of HTML and ditches them. Once you get used to writing in Haml, using Erb feels very wordy.

As for CSS, pick a framework (such as Blueprint), and use it as-is to start. You can always add Compass on later if you feel that you need it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文