I already had a project with .haml and .scss files in various folders.
I followed this guide here http://winstonyw.com/2013/02/24/jekyll_haml_sass_and_github_pages/ to create _plugins/haml.rb
and _plugins/sass.rb
I moved all my .scss files into ./assets/css/
folder
To make sure, I also created layouts
folder and put all .haml files in there.
I ran jekyll serve --watch
and these .haml / .scss files didn't get converted to .html or .css files in _sites. I cannot access them via the browser either.
I tried this file here and didn't help either https://gist.github.com/radamant/481456#file-haml_converter-rb
So what did I do wrong and how to watch live all .haml / .scss files?
I came from middlemanapp
world so jekyll
is new to me.
UPDATE 1:
My high level goals are:
Use Jekyll for frontend development with Sass and Haml
It must watch for changes in files
It must convert .sass / . scss files and Haml to .css and .html on watch. Meaning I could go to
http://localhost:4000/index.html
when in fact I have index.haml as HamlMy project doesn't follow the directory structure said in Jekyll doc (with layouts folder and others). This must be able to detect .sass and .haml files in other folders (I can specify this)
I don't want to modify any .sass or .scss files in the header to make Jekyll to detect it. Because I have tons of those (from Bootstrap) already
UPDATE 2:
Here is my new _config.yml
source: .
destination: ./_site
plugins: ./_plugins
layouts: .
Basically I want to have all .haml
files at the main folder, not layouts
. In _plugins
I have _plugins/haml.rb
and _plugins/sass.rb
as said above. Still, it doesn't work when I created a sample index1.haml
in the main folder, it didn't get converted when --watch
UPDATE 3:
Here is my directory structure:
/www
/_plugins
haml.rb
sass.rb
/_layouts
index1.haml
_config.yml
index1.haml
In haml.rb
:
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
rescue StandardError => e
puts "!!! HAML Error: " + e.message
end
end
end
In index1.haml
(both file has same content):
!!!
%html
%head
%meta{charset: "utf-8"}/
%meta{content: "initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width", name: "viewport"}/
%title
%body
Test Test
In _config.yaml
---
source: .
destination: ./_site
plugins: ./_plugins
layouts: ./_layouts
---
This still doesn't work for me. No .html files generated.
UPDATE $:
Adding this to .haml
files work:
---
title: Index
---
However, I can modify .haml
files but I try to avoid doing that with .sass
/ .scss
files. I have tons of them from Bootstrap and other work. Is there any workaround?