I'm looking for a templating engine. What are the important factors to consider when choosing among HAML, SASS/Compass and ERB?
我正在寻找一个模板引擎。在HAML,SASS / Compass和ERB中进行选择时需要考虑哪些重要因素?
1 个解决方案
#1
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.
Haml是一种标记语言
Sass是一组编译成标准CSS的CSS扩展
Compass是围绕Blueprint之类的Sass的包装器
Erb只是带有嵌入式Ruby代码的HTML。
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.
一般来说,你会看到Haml或Erb(虽然你可以根据需要混合和匹配),以及CSS或Sass。指南针只是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.
我建议从Haml和Sass开始,因为Haml采用了大多数令人讨厌的,容易出错的HTML方面并将其丢弃。一旦你习惯在Haml写作,使用Erb感觉非常罗嗦。
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.
至于CSS,选择一个框架(如Blueprint),并按原样使用它来启动。如果您觉得需要,可以随后添加Compass。
#1
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.
Haml是一种标记语言
Sass是一组编译成标准CSS的CSS扩展
Compass是围绕Blueprint之类的Sass的包装器
Erb只是带有嵌入式Ruby代码的HTML。
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.
一般来说,你会看到Haml或Erb(虽然你可以根据需要混合和匹配),以及CSS或Sass。指南针只是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.
我建议从Haml和Sass开始,因为Haml采用了大多数令人讨厌的,容易出错的HTML方面并将其丢弃。一旦你习惯在Haml写作,使用Erb感觉非常罗嗦。
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.
至于CSS,选择一个框架(如Blueprint),并按原样使用它来启动。如果您觉得需要,可以随后添加Compass。