Working with CodeKit and haml/PHP

2019-07-16 07:26发布

in my latests projects I have use Rails. Now I have to do something in PHP (which I actually hate, or love too much Ruby syntax).

So now I am very used to work with Sass and haml, which I also love. So I bought CodeKit for doing things outside rails framework.

Wanted just to know if there is any option for use haml in PHP files, or PHP in haml files, and that the file compiles with CodeKit, even having PHP.

标签: php haml
2条回答
在下西门庆
2楼-- · 2019-07-16 08:00

You can use the :plain filter to preserve the php, it does not parse the filtered text. This is useful when you need to keep multiple lines of php.

ex:

:plain
  <?php foreach ($es as $e) {
    echo $e;
  } ?>

I have not heard about any haml/php color syntax for Sublime Text 2 yet.

There is another setting that can be useful for working with php : check the don't escape HTML character in the HAML config on Codekit : http://d.pr/i/4pmv

This will manage with that

%form#booking_log{:name => "booking_log", :method => "post", :action => "<?=$this->action('bookingGetLog')?>"}
查看更多
forever°为你锁心
3楼-- · 2019-07-16 08:00

I know this is a very late reply, just found this question when searching myself.

In addition to Kevin's reply above:

You can automatically convert the html to php by simply setting the output path for that particular file, and then specifying the extension.

  1. Right click your HAML or HTML
  2. "Set output path..."
  3. "Output filename and extension"

Change it from index.html or index.haml to index.php.

查看更多
登录 后发表回答