Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime colorize :javascript block in haml

I have sublime 2/3 and the colorize inside a :javascript block doesn't work fine.

The package is this https://sublime.wbond.net/packages/Haml

Actually they says that: "Text inside Ruby, ERB, Javascript, Sass, and CSS filters are now properly recognized so you get all the syntax highlighting, snippets, commands, etc." but in sublime it doesn't work.

like image 450
woohoou Avatar asked Sep 17 '13 17:09

woohoou


1 Answers

Sublime 3 comes with preinstalled Rails package. This package also contains "Ruby Haml" syntax, which does not highlight embedded js etc. If you press ctrl + alt + p and type haml you will probably see two Set Syntax: Ruby Haml, one from Rails package, one from Haml. You need the latter to be used.

The best solution for me was to install ApplySyntax and in it's user settings add the following:

    // Put your custom syntax rules here:
    "syntaxes": [
        {
            "syntax": "Haml/Syntaxes/Ruby Haml",
            "extensions": ["haml"],
            "rules": [
                {"file_name": ".*\\.haml$"}
            ]
        }
    ]
like image 175
Kadu Diógenes Avatar answered Oct 14 '22 04:10

Kadu Diógenes