Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress with Haml/Sass

Having used Haml and Sass for a few Rails side projects, I've found that they speed up my frontend development tremendously. However, I haven't found a Rails blogging platform that's as robust or familiar to clients as Wordpress, so that's still generally my go-to for projects that require a light website with basic CMS / blogging functionality. (I've looked into Radiant, Mephisto, etc, and while I certainly appreciate suggestions of Rails blog engines, that's not really the question I'm looking to answer here.)

I'd really like to be able to use Haml and Sass in the context of a Wordpress site, and while I'm aware of the existence of various PHP implementations, most seem inactive or buggy. Has anyone here had success using Haml and Sass with Wordpress sites? I'm asking this both in the context of Wordpress template files (the .php files that power a Wordpress theme) and in the HTML editing mode of the Wordpress editor, though the latter is far less important.

Note: I'm aware that I can just install the appropriate ruby gems and compile my own HTML/CSS from the Haml/Sass source; what I'm looking for is something more along the lines of the functionality I'm used to in Rails, where the compiled HTML/CSS is autogenerated on a per-request basis (caching behaviour would also be nice, but is certainly not required).

Thanks in advance!

like image 369
justinbach Avatar asked Oct 28 '10 14:10

justinbach


4 Answers

You probably want to check out WORDLESS https://github.com/welaika/wordless

It's a Wordpress plug-in that comes with compass/SASS, CoffeScript, and Haml.

like image 159
Christopher Castiglione Avatar answered Oct 14 '22 16:10

Christopher Castiglione


I'm in the same boat with respect to the sites with a low demand for customization. I'm so used to Haml and Sass that going back to HTML and CSS seems painful. PHamlP has gotten some good reviews, especially because it supports Sass: (http://code.google.com/p/phamlp/). Still, there's no substitute for the real thing.

If it were my project, I'd consider Compass and just do a compass update when I made changes. Sass is too good to pass up. Haml is your daily bread and butter, but Sass can really help you make pages sing. It suggests stylesheet refactorings you might never have thought of otherwise.

like image 30
Steve Ross Avatar answered Oct 14 '22 18:10

Steve Ross


Here is a new plugin I just released: http://wordpress.org/extend/plugins/wordpress-sass/

It does use PHamlP, with all its warts, but at least it doesn't require Compass on the server.

The plugin is very simple to implement and automatically regenerates your style.css whenever the style.scss file (or whatever you choose to name it) is updated.

More info: http://blogrescue.com/2011/12/sass-for-wordpress/

Ed

like image 1
Ed Burns Avatar answered Oct 14 '22 18:10

Ed Burns


I created a development toolkit to make using HAML, PHP, and SASS a breeze with WordPress themes. It also compiles your JavaScript! Everything ends up compiled together into a WordPress theme. When I came across this question, this was my solution. I hope this helps a bit:

https://github.com/zachfeldman/wordpress-haml-sass

like image 1
Zach Feldman Avatar answered Oct 14 '22 17:10

Zach Feldman