Question

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.


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?


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?

Was it helpful?

Solution

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.

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.

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

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.

OTHER TIPS

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? :-)

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.

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.

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.

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.

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

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.

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

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.

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!)

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.

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.

why is this..

%p
  hello world

better than this..?

<p>hello world</p>

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.

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.

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

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

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.

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.)

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 }.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top