热门标签 | 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。我喜欢它,并将继续使用它。然而,我发现一个问题是错误消息并不总是特别直观,特别是如果您省略了}。


推荐阅读
  • 在寻找轻量级Ruby Web框架的过程中,您可能会遇到Sinatra和Ramaze。两者都以简洁、轻便著称,但它们之间存在一些关键区别。本文将探讨这些差异,并提供详细的分析,帮助您做出最佳选择。 ... [详细]
  • Logback使用小结
    1一定要使用slf4j的jar包,不要使用apachecommons的jar。否则滚动生成文件不生效,不滚动的时候却生效~~importorg.slf ... [详细]
  • 本文详细介绍了如何在现有的Android Studio项目中集成JNI(Java Native Interface),包括下载必要的NDK和构建工具,配置CMakeLists.txt文件,以及编写和调用JNI函数的具体步骤。 ... [详细]
  • 本篇文章介绍如何将两个分别表示整数的链表进行相加,并生成一个新的链表。每个链表节点包含0到9的数值,如9-3-7和6-3相加得到1-0-0-0。通过反向处理链表、逐位相加并处理进位,最终再将结果链表反向,即可完成计算。 ... [详细]
  • 本文探讨了C++编程中理解代码执行期间复杂度的挑战,特别是编译器在程序运行时生成额外指令以确保对象构造、内存管理、类型转换及临时对象创建的安全性。 ... [详细]
  • 本文探讨了如何利用HTML5和JavaScript在浏览器中进行本地文件的读取和写入操作,并介绍了获取本地文件路径的方法。HTML5提供了一系列API,使得这些操作变得更加简便和安全。 ... [详细]
  • ListView简单使用
    先上效果:主要实现了Listview的绑定和点击事件。项目资源结构如下:先创建一个动物类,用来装载数据:Animal类如下:packagecom.example.simplelis ... [详细]
  • 本文详细介绍了get和set方法的作用及其在编程中的实现方式,同时探讨了点语法的使用场景。通过具体示例,解释了属性声明与合成存取方法的概念,并补充了相关操作的最佳实践。 ... [详细]
  • 深入剖析JVM垃圾回收机制
    本文详细探讨了Java虚拟机(JVM)中的垃圾回收机制,包括其意义、对象判定方法、引用类型、常见垃圾收集算法以及各种垃圾收集器的特点和工作原理。通过理解这些内容,开发人员可以更好地优化内存管理和程序性能。 ... [详细]
  • 搭建Jenkins、Ant与TestNG集成环境
    本文详细介绍了如何在Ubuntu 16.04系统上配置Jenkins、Ant和TestNG的集成开发环境,涵盖从安装到配置的具体步骤,并提供了创建Windows Slave节点及项目构建的指南。 ... [详细]
  • 本文详细探讨了Java中的包管理机制,包括默认包的使用和自定义包名的创建方法。通过实际操作,帮助开发者更好地理解和应用包管理。 ... [详细]
  • 本文详细介绍了 Android 开发中 layout_gravity 属性的使用方法及其在不同布局下的效果,旨在帮助开发者更好地理解和利用这一属性来精确控制视图的布局。 ... [详细]
  • 一个登陆界面
    预览截图html部分123456789101112用户登入1314邮箱名称邮箱为空15密码密码为空16登 ... [详细]
  • Chapter11&12:DefocusBlur&FinalScene在Camera.h中修改如下:#pragmaonce#define_USE ... [详细]
  • 本文介绍了在CentOS 6.4系统中安装MySQL 5.5.37时遇到的启动失败和PID文件问题,并提供了详细的解决方案,包括日志分析、权限检查等步骤。 ... [详细]
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社区 版权所有