-
-
Save radamant/481456 to your computer and use it in GitHub Desktop.
module Jekyll | |
require 'haml' | |
class HamlConverter < Converter | |
safe true | |
priority :low | |
def matches(ext) | |
ext =~ /haml/i | |
end | |
def output_ext(ext) | |
".html" | |
end | |
def convert(content) | |
engine = Haml::Engine.new(content) | |
engine.render | |
end | |
end | |
require 'sass' | |
class SassConverter < Converter | |
safe true | |
priority :low | |
def matches(ext) | |
ext =~ /sass/i | |
end | |
def output_ext(ext) | |
".css" | |
end | |
def convert(content) | |
engine = Sass::Engine.new(content) | |
engine.render | |
end | |
end | |
end |
sorry if this is obvious/stupid - how do you use the stuff defined in the YAML front-matter inside the haml chunk?
i could always move it down as a variable, but that's a bit ugly...
@mwotton, you have to put it inside Moustache markup. See the docs here: https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter
@dtjm so no variables are actually defined for the use of the Haml renderer? Does the Moustache get run first or second? I guess " - @InputData = {{ inputdata }}" isn't terrible, if the Moustach gets run first...
@mwotton, oh I see what you are saying. I don't know if there are variables available in the HAML scope.
is it possible to mix haml and markdown ? or is that a crazy question because both are a kind of templating sugar and why would one be used with the other ?
@rubyonrailstutor Absolutely! Check out this section of the HAML docs. It requires the markdown to be put in it's own section, but it should work nicely from what others on the net have said.
@radamant how can I prevent Jekyll completely from compiling my SCSS files? I want to handle it myself with 3rd party solutions outside of Jekyll.
Yes, I too love compass. I actually updated the command so I can keep the haml files separate from the html:
system("for i in ./layouts_haml/.haml; do [ -e$i ] && n=$ {i%._} && haml $i ./_layouts/$ {n##*/}.html; done & compass watch & jekyll --auto --server")
The only thing annoying about this solution is it doesn't behave the same way 'compass watch' or 'jekyll --auto' do. I have to stop/start the server every time I make a change to my layout.
I've added an issue to the mojombo/jekyll git project if anyone would like to join me in asking for this to get fixed:
http://github.com/mojombo/jekyll/issues#issue/225