简体   繁体   English

如果SASS是HAML的一部分,为什么在Merb中需要Compass?

[英]If SASS is part of HAML, why do I need Compass in Merb?

This is a theoretical question as much as a practical one. 这既是理论问题,也是实际问题。 I just can't wrap my head around how all these technologies mesh... 我只是无法将所有这些技术如何结合在一起...

I have heard various things including: 我听说过很多事情,包括:

So my question is: ...WHAT?? 所以我的问题是:...什么?

I do have SASS working in Merb. 我在Merb中确实有SASS。 I have installed Compass and used the instructions on Chris Eppstein's Github wiki to get it working. 我已经安装了Compass,并按照Chris Eppstein的Github Wiki上的说明进行操作。 But why is Compass needed, and why do many sources seem to think that it is not needed and SASS support is built into HAML or Merb? 但是,为什么需要Compass,为什么许多消息源似乎认为不需要Compass,并且HAML或Merb中内置了SASS支持?

"HAML and SASS are included in Merb" “ HAML和SASS包含在Merb中”

No, they are separate. 不,它们是分开的。

"SASS is part of HAML" “ SASS是HAML的一部分”

Sass and Haml, while technically pretty different libraries, come bundled together. Sass和Haml,尽管在技术上完全不同,但它们捆绑在一起。 They are both part of the haml gem. 它们都是haml宝石的一部分。 So you need to install that gem to use Sass. 因此,您需要安装该gem才能使用Sass。 Note that that doesn't require you to actually use Haml in your application. 请注意,这并不需要您在应用程序中实际使用Haml。

"HAML works in Merb, but to use SASS you need to add the 'merb-haml' dependency" “ HAML在Merb中有效,但是要使用SASS,您需要添加'merb-haml'依赖项”

It's actually the other way round. 实际上是相反的方式。 You can use Haml in merb by installing the merb-haml gem. 您可以通过安装merb-haml gem在merb中使用Haml。 This adds Haml-specific merb generators and plugs into merbs templating. 这将添加特定于Haml的Merb生成器,并将其插入到Merbs模板中。 Sass however only requires the haml dependency (in config/dependencies.rb) for it to work with merb. 但是,Sass仅需要haml依赖项(在config / dependencies.rb中)才能与merb一起使用。

"You need Compass to run SASS in Merb" “您需要Compass才能在Merb中运行SASS”

Not true. 不对。 Compass is a framework built on top of Sass. Compass是建立在Sass之上的框架。 It has tons of general purpose functions for CSS styling. 它具有用于CSS样式的大量通用功能。 But you don't need Compass to use Sass. 但是您不需要Compass即可使用Sass。 You can take a look at the docs . 您可以看一下docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM