Sublime Forum

Automatic build HAML

#1

I’m trying to let Sublime build haml files automatic on save. I’ve installed SublimeOnSaveBuild, added haml extension:

{
“filename_filter”: “\.(css|js|sass|less|scss|haml)$”,
“build_on_save”: 1
}
and created haml.sublime-build in AppData\Roaming\Sublime Text 3\Packages\User (originally from gist.github.com/esimov/3898955):

{
“cmd”: “haml”],
“working_dir”: “${file_path:${folder}}”,
“selector”: “source.haml”,
“file_regex”: “(.\.ts?)\s\(([0-9]+)\,([0-9]+)\)\:\s(…?)$”,

"windows":
{
    "cmd": "haml", "--trace", "$file", "${file_base_name}.html"],
    "shell": "true"
}

}
As a result it works fine if I set build system = haml, but it doesn’t if I try to set automatic ddetection of build system. Can anyone help with this issue?

P.S. I’m using sublime 3 without any additional plugins and extensions, but SublimeOnSaveBuild

P.P.S Also automatic detection works good for scss files

0 Likes

#2

but it doesn’t if I try to set automatic ddetection of build system.

0 Likes

#3

I’m not sure I’ve understood you correctly…what do you mean?

0 Likes

#4

Is it a known issue or I’m doin something wrong?

0 Likes

#5

Finally I’ve found my mistake.
The problem was in line

“selector”: “source.haml”
It happens because file’s scope for haml looks a bit different - “text.haml” instead of “source.haml”. So I’ve change line above to:

“selector”: “text.haml”
and in works for me. You may find out the file’s scope in sublime by pressing Ctrl + Alt + Shift + P on file’s tab

0 Likes

#6

HTML and markup languages in general are set under the “text” scope, so the HAML syntax is correct in following suit.

I haven’t really tinkered with HAML but for processing things like this I use Grunt. Have you looked into that at all? It’s probably a bit more of a hassle to set up the first time, especially for a small project, but I’ve found tremendous gains over time. It’s also editor-agnostic, which makes it easier to document the workflow and collaborate with others.

0 Likes

#7

I agree with quodlibet - it might be worth looking into Grunt, Gulp or even a desktop app like Prepros to handle your compiling - much easier and a nicer interface than the Sublime Text build system.

0 Likes