Skip to content

Instantly share code, notes, and snippets.

@telekineticyeti
Last active August 29, 2015 13:57
Show Gist options
  • Save telekineticyeti/9773632 to your computer and use it in GitHub Desktop.
Save telekineticyeti/9773632 to your computer and use it in GitHub Desktop.
A simple HAML PHP Filter for middleman.
module Haml::Filters::Php
include Haml::Filters::Base
def render(text)
<<END
<?php
#{text.rstrip.gsub("\n", "\n ")}
?>
END
end
end
# Reference this file in your Middleman project's config.rb:
# require 'phpfilter'
#
# Use 'php:' to invoke filter. All following indented code will be wrapped in <?php ?> tags
#
# Example:
#
# php:
# phpinfo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment