热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

有什么理由反对HAML/SASS?-WhatwouldbesomereasonstodecideagainstHAML/SASS?

IvebeenreadingupaboutHAMLSASSlatelyandImnotquitesurewhyanyonewouldnotwanttouse

I've been reading up about HAML/SASS lately and I'm not quite sure why any one would not want to use it. It seems to be very easy to switch, makes things cleaner and more efficient.

我最近一直在阅读关于HAML/SASS的文章,我不确定为什么没有人不愿意使用它。它似乎很容易转换,使事情更干净和更有效率。


Update:

更新:

What about using one or the other? Most of the complaints (the few complaints there are) I hear seem to be about HAML, would there be any problems mixing and matching XHTML/HAML and CSS/SASS?

使用一个或另一个怎么样?我听到的大多数抱怨(为数不多的抱怨)似乎都是关于HAML的,混合和匹配XHTML/HAML和CSS/SASS会有什么问题吗?


Update:

更新:

Sorry, one final update to the question. It seems to me that switching back from SASS to CSS is painless and simple. What about switching back from HAML to HTML?

不好意思,最后一个问题。在我看来,从SASS切换回CSS很简单。从HAML切换回HTML怎么样?

11 个解决方案

#1


11  

If you're using Rails, yes. Go for it. Some issues you will hit, though, will be that any other developer brought onto the team later will have to learn it, as well. If you're already working with a big Rails crowd, that's fine, but HAML/SASS may confuse a designer who's worked with pure HTML/CSS for years.

如果你正在使用Rails,是的。就去做吧。但是,您将会遇到的一些问题是,任何其他开发人员在稍后引入到团队中,也将不得不学习它。如果您已经在与大量的Rails用户一起工作,那是可以的,但是HAML/SASS可能会让使用纯HTML/CSS多年的设计师感到困惑。

If you're not using Rails, though, a good HAML/SASS integrated system is hard to come by. There are a few out there, but I imagine they're not as well-supported or as far along with the spec.

但是,如果您不使用Rails,那么很难获得一个好的HAML/SASS集成系统。有一些在那里,但我认为他们不是很好的支持,或与规格一样远。

But, yeah. HAML/SASS is definitely worth it. The only real issue you'll hit is that it's not yet standard.

但,是的。HAML/SASS绝对值得。你唯一会遇到的问题是它还不是标准的。

As for mix-n-match, HAML and SASS are so similar in style that I'd say go for both, but it, again, comes down to personal preference. Try using both for a day, and if you don't like one of them, switch back. There's no technological issue about it, so do what you prefer.

至于mix-n-match, HAML和SASS在风格上是如此相似,所以我想说两者都有,但这又取决于个人喜好。试着把这两种都用一天,如果你不喜欢其中一种,那就换回去。这没有技术问题,所以你喜欢怎么做就怎么做。

#2


6  

There are lots of tools for working with HTML and CSS. The syntax isn't pretty, but the improvements from HAML and SASS don't seem that dramatic to me, and for many they're not worth the trouble. Of course, for those developing web application with widely differing frameworks (differing from Rails that is) it's even harder to find a reason to go to the pain of integrating something so foreign. (Example: care to explain what I'd have to do to integrate SASS into my Java/Stripes/JSP environment? :-)

有很多工具可以使用HTML和CSS。语法不是很好,但是HAML和SASS的改进在我看来并不是那么引人注目,对许多人来说,它们不值得麻烦。当然,对于那些使用不同框架(不同于Rails)开发web应用程序的人来说,很难找到一个理由去集成如此外国的东西。(示例:请解释一下要将SASS集成到Java/Stripes/JSP环境中需要做什么?):-)

#3


5  

I've been on volunteer projects where HAML's syntax curve (syntactical whitespace, the automatic generation of tags etc) has been seen as a barrier: one more thing for a programmer new to the project to learn.

我曾参与过一些志愿者项目,在这些项目中,HAML的语法曲线(语法空白、自动生成标签等)被视为一个障碍:对于一个刚进入项目的程序员来说,还有一件事需要学习。

Personally, I think SASS is worth it, but I'm up in the air about HAML: having debugged HAML templates before it seems like the typing you don't have to do with HAML is overcome by the time you spend debugging why there's an error on your templates. This could be a (HAML) newbie's perspective though.

就我个人而言,我认为SASS值得这么做,但我对HAML还是举棋不定:在HAML模板上调试过之后,就好像你不用HAML来进行输入一样,当你花时间调试为什么你的模板上有错误的时候,你就会克服这个问题。这可能是一个(HAML)新手的观点。

#4


3  

I'm inclined to agree with the question; it is easy to switch, the syntax isn't that complicated, and it does make things cleaner and more efficient. It also makes it harder to unwittingly generate invalid HTML.

我倾向于同意这个问题;它很容易转换,语法也不那么复杂,而且它确实使事情更简洁、更高效。这也使得在不知情的情况下生成无效的HTML更加困难。

I also think the learning curve is shallow enough that a programmer that can't handle it, is probably a programmer you are better off without on your team. That might sound harsh, but I believe it.

我还认为学习曲线很浅,程序员无法处理,很可能是程序员,而不是团队。这听起来可能有些刺耳,但我相信。

The only cons I can see would be if you are developing in ASP.NET or something where retrofitting Haml and Sass would be a pain, is way unexpected for anyone else used to the platform, and possible a chore to maintain in a production environment. On Rails though, go for it.

我能看到的唯一缺点是如果你在ASP开发。NET或任何对Haml和Sass进行改造会很痛苦的东西,对于任何习惯于这个平台的人来说都是意想不到的,并且可能是在生产环境中维护的一件苦差事。尽管在轨道上,去做吧。

#5


2  

I don't think that using HAML ever adds much benefit to a project.

我不认为使用HAML会给项目带来什么好处。

SASS, on the other hand, effectively introduces variables and computations and other really useful features that save you time and effort in the long run on larger projects.

另一方面,SASS有效地引入了变量、计算和其他真正有用的特性,这些特性可以节省您在大型项目上长期运行的时间和精力。

Using SASS is incredibly smart with any project that's larger than just a simple one-page form.

使用SASS对于任何比简单的单页表单更大的项目来说都是非常聪明的。

#6


2  

I tried using SASS but found that editing CSS using MacRabitt's CSSEdit (Mac Only) was way easier and more efficient for the way I work. I'm a very visual person and like to have a live preview when making changes to style sheets and didn't feel like investing a ton of time into something I wasn't having a problem with.

我尝试使用SASS,但发现使用MacRabitt的CSSEdit(仅适用于Mac)编辑CSS对我的工作方式来说更容易、更有效。我是一个非常有视觉的人,喜欢在修改样式表时进行实时预览,并且不想花大量时间在我没有问题的事情上。

#7


2  

One thing most people don't realize is that HAML sucks for content. It's great for structural markup, but don't try and push it too far. (You can mix & match HTML in your HAML file, too!)

大多数人没有意识到的一件事是HAML很烂。这对于结构化标记很有用,但是不要尝试太过分。(您也可以在HAML文件中混合和匹配HTML !)

Sass is absolutely indispensable, especially in the long run. It's not just about writing the stylesheets when you have it all in your head, but about maintaining them down the road. The new Sass3 takes the syntax question out of the equation: you can take your pick if you prefer the curly-bracey SCSS syntax.

Sass是绝对不可或缺的,尤其是从长远来看。这不仅仅是在脑子里有了样式表之后编写样式表,而是在以后维护它们。新的Sass3将语法问题从等式中去掉:如果您喜欢卷曲的SCSS语法,可以选择。

#8


1  

HAML/SASS may indeed be awesome to use, but they do introduce dependencies both technical and knowledge-oriented. This may not be an issue if your dev and prod environments are controlled and predictable enough, with newbies receiving enough training (or being vetted for subject knowledge on the way into the organization) to hit the ground running, but all of that is overhead to be acknowledged.

HAML/SASS使用起来确实很棒,但是它们引入了技术上的依赖和面向知识的依赖。如果您的开发和prod环境受到足够的控制和足够的预测,这可能不是一个问题,因为新手接受了足够的培训(或者在进入组织的过程中接受了专业知识的审查),但是所有这些都是需要承认的。

#9


1  

why is this..

这是为什么. .

%p
  hello world

better than this..?

比这更好. . ?

hello world

clue.. If you aren't doing ruby, it isn't. Unfortunately adding closing tags and braces isn't really the most challenging aspect of making webpages, so most professionals wouldn't really care. Use whichever you prefer.

线索……如果你不做ruby,那就不是。不幸的是,添加关闭标签和大括号并不是制作网页最具挑战性的方面,所以大多数专业人士不会真正在意。使用您喜欢的任何一个。

#10


0  

From a developer's perspective, Haml and Sass absolutely rock. However: from a designer's perspective, Haml and Sass might not be readable. It really depends on who is on your team.

从开发人员的角度来看,Haml和Sass绝对是摇滚。然而:从设计师的角度来看,Haml和Sass可能是不可读的。这取决于你的团队是谁。

If it's a bunch of developers and/or designers who aren't afraid to learn a DSL, then absolutely go for it.

如果有一群开发人员和/或设计人员不害怕学习DSL,那么一定要去学习它。

If you have a mixed team where designers toss their CSS and HTML work to developers who translate that to Haml/Sass, sure.

如果你有一个混合的团队,设计师把他们的CSS和HTML工作扔给那些把它翻译成Haml/Sass的开发人员,当然。

If you have a design team that passes work to the developers AND the work flows back to the designers, you may not want to use this because the designers might not be able to use their tools to edit the files.

如果您有一个将工作传递给开发人员的设计团队,并且工作流返回给设计人员,您可能不希望使用它,因为设计人员可能无法使用他们的工具来编辑文件。

If you have a small team where marketing and business people need to edit the web pages and they only know HTML and a light bit of CSS, then you probably shouldn't use Haml/Sass.

如果你有一个小团队,营销人员和商务人员需要编辑网页,他们只知道HTML和一点CSS,那么你可能不应该使用Haml/Sass。

However you can't really make a blanket statement here. Consider that at least with Rails you can mix the template types in your views. So, some of your templates can be plain HTML stuck in .erb files, and other pages are .haml files. You can have partials be of one type inserted into templates of another. (I think mixing types is probably a bad practice, but if you just need to "get the job done" then it's an option.)

但是你不能在这里做一个全面的陈述。考虑到至少可以使用Rails在视图中混合模板类型。因此,您的一些模板可以是普通的HTML卡在.erb文件中,其他页面可以是.haml文件。可以将一种类型的部分插入到另一种类型的模板中。(我认为混合类型可能是一种不好的做法,但如果你只是需要“完成工作”,那么这是一种选择。)

#11


0  

I am using SASS on a Django project right now. I like it and am going to continue using it. One problem I've found however is that error messages aren't always particularly intuitive, particularly if you leave off a }.

我正在Django项目中使用SASS。我喜欢它,并将继续使用它。然而,我发现一个问题是错误消息并不总是特别直观,特别是如果您省略了}。


推荐阅读
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • ShiftLeft:将静态防护与运行时防护结合的持续性安全防护解决方案
    ShiftLeft公司是一家致力于将应用的静态防护和运行时防护与应用开发自动化工作流相结合以提升软件开发生命周期中的安全性的公司。传统的安全防护方式存在误报率高、人工成本高、耗时长等问题,而ShiftLeft提供的持续性安全防护解决方案能够解决这些问题。通过将下一代静态代码分析与应用开发自动化工作流中涉及的安全工具相结合,ShiftLeft帮助企业实现DevSecOps的安全部分,提供高效、准确的安全能力。 ... [详细]
  • SQL Server 2008 到底需要使用哪些端口?
    SQLServer2008到底需要使用哪些端口?-下面就来介绍下SQLServer2008中使用的端口有哪些:  首先,最常用最常见的就是1433端口。这个是数据库引擎的端口,如果 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文介绍了[从头学数学]中第101节关于比例的相关问题的研究和修炼过程。主要内容包括[机器小伟]和[工程师阿伟]一起研究比例的相关问题,并给出了一个求比例的函数scale的实现。 ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • 本文介绍了多因子选股模型在实际中的构建步骤,包括风险源分析、因子筛选和体系构建,并进行了模拟实证回测。在风险源分析中,从宏观、行业、公司和特殊因素四个角度分析了影响资产价格的因素。具体包括宏观经济运行和宏经济政策对证券市场的影响,以及行业类型、行业生命周期和行业政策对股票价格的影响。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • WebSocket与Socket.io的理解
    WebSocketprotocol是HTML5一种新的协议。它的最大特点就是,服务器可以主动向客户端推送信息,客户端也可以主动向服务器发送信息,是真正的双向平等对话,属于服务器推送 ... [详细]
  • 李逍遥寻找仙药的迷阵之旅
    本文讲述了少年李逍遥为了救治婶婶的病情,前往仙灵岛寻找仙药的故事。他需要穿越一个由M×N个方格组成的迷阵,有些方格内有怪物,有些方格是安全的。李逍遥需要避开有怪物的方格,并经过最少的方格,找到仙药。在寻找的过程中,他还会遇到神秘人物。本文提供了一个迷阵样例及李逍遥找到仙药的路线。 ... [详细]
  • 本文介绍了Codeforces Round #321 (Div. 2)比赛中的问题Kefa and Dishes,通过状压和spfa算法解决了这个问题。给定一个有向图,求在不超过m步的情况下,能获得的最大权值和。点不能重复走。文章详细介绍了问题的题意、解题思路和代码实现。 ... [详细]
  • Ihaveaworkfolderdirectory.我有一个工作文件夹目录。holderDir.glob(*)>holder[ProjectOne, ... [详细]
  • TPL实现Task.WhileAll扩展方法
    文章翻译整理自NikolaMalovic两篇博文:Task.WhileAllAwaitabletaskprogressreporting当Task.WhenAll遇见 ... [详细]
  • 1、概述首先和大家一起回顾一下Java消息服务,在我之前的博客《Java消息队列-JMS概述》中,我为大家分析了:然后在另一篇博客《Java消息队列-ActiveMq实战》中 ... [详细]
author-avatar
whucad
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有