Is there a haml to html converter for windows I see it on ubuntu we uses grunt. Ex. In the terminal grunt haml converts my code .haml to .php offline. Do windows have app or something?
Asked
Active
Viewed 694 times
1 Answers
0
There's grunt-haml-php. But it doesn't work well on windows. In order to make it run on windows, you have to make some hacks into it.
After installation is done, find node_moules/grunt-haml-php/tasks/haml.js file and we have to do some tweak like this.
...
var compileHaml = function(item, cb) {
var args = ['-t', hamlTarget || 'php', item ];
// change the above line to the following
// var args = [path.join(__dirname, '../bin/haml'), '-t', hamlTarget || 'php', item ];
...
var child = grunt.util.spawn({
cmd: path.join(__dirname, '../bin/haml'),
// change the above line to the following
// cmd: 'php',
args: args
}, function(error, result, code) {
cb(error, result.stdout);
});
...
grunt-haml-php uses MtHaml, but looks like MtHaml is still not stable. It lacks many features yet.
Hope this answer helps you what you're looking for.

elquimista
- 2,181
- 2
- 23
- 32
-
@GoperLeoZosa, [slim](http://slim-lang.com) is getting more popular than HAML on Ruby on Rails, so I thought about implementing slim template engine into PHP. – elquimista Dec 22 '15 at 05:05
-
There are several php libraries such as [maht0rz/jade](https://packagist.org/packages/maht0rz/jade), [kylekatarnls/jade-php](https://packagist.org/packages/kylekatarnls/jade-php), but these are all PHP ported versions of [Jade](https://jade-lang.com). So I decided to make a new php library that's similar to ruby's slim. I'll post a link to the repo once I finish the phase I. – elquimista Dec 22 '15 at 05:18
-
Finally v0.0.1 released for [slimphp](https://packagist.org/packages/clthck/slimphp) and [grunt-slim-php](https://www.npmjs.com/package/grunt-slim-php). It's very promising and I'm gonna add a number of slim features to them. – elquimista Dec 22 '15 at 16:40
-
MtHaml is pretty stable (as in "no breaking change since months/years"), battle tested (as in "lots of people use it"), and well tested (as in "great code coverage"). Also, it can compile to Twig or PHP; compiling to Twig is a huge feature since you get all of Twig features for free. – Arnaud Le Blanc Dec 31 '15 at 09:39
-
@arnaud576875 I didn't mean to blame MtHaml actually. sorry about that. I just tried to say that slim is much slimer than haml. I tried to find out PHP version of slim template preprocessor but no luck. That's why I decided to make one. – elquimista Jan 03 '16 at 11:29